You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an errorhandler is registered on a namespace, and PROPAGATE_EXCEPTIONS is set to True in the Flask app, then the namespace handler will not catch the exceptions. It looks like this is due to the handle_error function not checking the error handlers that exist in any child classes.
Code
api.py:653
if (
notisinstance(e, HTTPException)
andcurrent_app.propagate_exceptionsandnotisinstance(e, tuple(self.error_handlers.keys()))
):
Should check for potential error handlers in the class and child classes:
if (
notisinstance(e, HTTPException)
andcurrent_app.propagate_exceptionsandnotisinstance(e, tuple(self._own_and_child_error_handlers.keys()))
):
Repro Steps (if applicable)
Set propagate_exceptions=True in the app
Create a namespace, and register it to the API
Add a @namespace.errorhandler function
Raise error in a route, which won't get caught by namespace's error handler
Expected Behavior
Error handler defined on a namespace should still catch exceptions when propagate_exceptions is True.
The text was updated successfully, but these errors were encountered:
Details
When an
errorhandler
is registered on a namespace, andPROPAGATE_EXCEPTIONS
is set toTrue
in the Flask app, then the namespace handler will not catch the exceptions. It looks like this is due to thehandle_error
function not checking the error handlers that exist in any child classes.Code
api.py:653
Should check for potential error handlers in the class and child classes:
Repro Steps (if applicable)
propagate_exceptions=True
in the app@namespace.errorhandler
functionExpected Behavior
Error handler defined on a namespace should still catch exceptions when
propagate_exceptions
isTrue
.The text was updated successfully, but these errors were encountered: