Skip to content

Commit 6f833db

Browse files
committed
Stops calling got_request_exception for exceptions explicitly handled.
1 parent 41b3b59 commit 6f833db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flask_restx/api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,6 @@ def handle_error(self, e):
659659
:param Exception e: the raised Exception object
660660
661661
"""
662-
got_request_exception.send(current_app._get_current_object(), exception=e)
663-
664662
# When propagate_exceptions is set, do not return the exception to the
665663
# client if a handler is configured for the exception.
666664
if (
@@ -690,6 +688,10 @@ def handle_error(self, e):
690688
)
691689
break
692690
else:
691+
# Flask docs say: "This signal is not sent for HTTPException or other exceptions that have error handlers
692+
# registered, unless the exception was raised from an error handler."
693+
got_request_exception.send(current_app._get_current_object(), exception=e)
694+
693695
if isinstance(e, HTTPException):
694696
code = HTTPStatus(e.code)
695697
if include_message_in_response:

0 commit comments

Comments
 (0)