File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -452,9 +452,8 @@ def add_error_handler(
452
452
453
453
:param code_or_exception: An exception class or the status code of HTTP exceptions to
454
454
handle.
455
- :param function: Callable that will handle exception and return a HTTP problem response.
456
- An async coroutine has access to the stack traceback. A sync function has no access
457
- to the stack traceback because it is run in a threadpool.
455
+ :param function: Callable that will handle the exception and return a ConnexionResponse such
456
+ as a `connexion.problem.problem`. May be async; a sync function is run in a threadpool.
458
457
"""
459
458
if self .middleware_stack is not None :
460
459
raise RuntimeError (
Original file line number Diff line number Diff line change @@ -115,11 +115,8 @@ You can register error handlers on:
115
115
116
116
.. note ::
117
117
118
- All the error handlers shown above are sync functions. The exception stack trace is
119
- not available in a sync function because the middleware runs it in a threadpool.
120
-
121
- Error handlers can be ``async `` coroutines as well. Use a coroutine if the handler
122
- function needs the stack trace from the exception, for example to log a traceback.
118
+ Error handlers can be ``async `` coroutines as well. If the error handler needs to log
119
+ the exception, pass the exception using the Python logger's ``exc_info `` parameter.
123
120
124
121
.. _Flask documentation : https://flask.palletsprojects.com/en/latest/errorhandling/#error-handlers
125
122
You can’t perform that action at this time.
0 commit comments