Repository navigation
Fix #378 by adding middleware error handlers - #401
Conversation
| except Exception as error: | ||
| resp = BoltResponse(status=500, body="") | ||
| self._middleware_error_handler.handle( | ||
| error=error, | ||
| request=req, | ||
| response=resp, | ||
| ) | ||
| return resp |
There was a problem hiding this comment.
These lines of code are the essential changes in this pull request.
| logger=self._framework_logger, | ||
| func=func, | ||
| ) | ||
| self._middleware_error_handler = CustomMiddlewareErrorHandler( |
There was a problem hiding this comment.
For backward-compatibility, I didn't rename and modify the existing CustomListenerErrorHandler to be reusable for this. In the future major version, we may want to have a unified interface for these two error handlers. They are mostly the same.
| @@ -1,58 +0,0 @@ | |||
| from logging import Logger | |||
There was a problem hiding this comment.
As this internal code is no longer used, we can safely delete the whole. We've switched to slack_bolt/kwargs_inject/async_utils.py
Codecov Report
@@ Coverage Diff @@
## main #401 +/- ##
==========================================
+ Coverage 89.65% 91.72% +2.07%
==========================================
Files 128 167 +39
Lines 3585 5436 +1851
==========================================
+ Hits 3214 4986 +1772
- Misses 371 450 +79
Continue to review full report at Codecov.
|
This pull request fixes #378 by applying the following changes:
AppandAsyncApp@app.errorregistration to enable the custom error handler for both middleware and listenersCategory (place an
xin each of the[ ])slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements (place an
xin each[ ])Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.