-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Details
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 (
not isinstance(e, HTTPException)
and current_app.propagate_exceptions
and not isinstance(e, tuple(self.error_handlers.keys()))
):Should check for potential error handlers in the class and child classes:
if (
not isinstance(e, HTTPException)
and current_app.propagate_exceptions
and not isinstance(e, tuple(self._own_and_child_error_handlers.keys()))
):Repro Steps (if applicable)
- Set
propagate_exceptions=Truein the app - Create a namespace, and register it to the API
- Add a
@namespace.errorhandlerfunction - 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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working