Skip to content

Stops calling got_request_exception for exceptions explicitly handled. #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions flask_restx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,6 @@ def handle_error(self, e):
:param Exception e: the raised Exception object

"""
got_request_exception.send(current_app._get_current_object(), exception=e)

# When propagate_exceptions is set, do not return the exception to the
# client if a handler is configured for the exception.
if (
Expand Down Expand Up @@ -690,6 +688,10 @@ def handle_error(self, e):
)
break
else:
# Flask docs say: "This signal is not sent for HTTPException or other exceptions that have error handlers
# registered, unless the exception was raised from an error handler."
got_request_exception.send(current_app._get_current_object(), exception=e)

if isinstance(e, HTTPException):
code = HTTPStatus(e.code)
if include_message_in_response:
Expand Down