Skip to content

Commit 4893b79

Browse files
chandlerninevaustrup
authored andcommitted
Stops calling got_request_exception for exceptions explicitly handled.
1 parent 0dc1c3c commit 4893b79

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
@@ -679,8 +679,6 @@ def handle_error(self, e):
679679
:param Exception e: the raised Exception object
680680
681681
"""
682-
got_request_exception.send(current_app._get_current_object(), exception=e)
683-
684682
# When propagate_exceptions is set, do not return the exception to the
685683
# client if a handler is configured for the exception.
686684
if (
@@ -710,6 +708,10 @@ def handle_error(self, e):
710708
)
711709
break
712710
else:
711+
# Flask docs say: "This signal is not sent for HTTPException or other exceptions that have error handlers
712+
# registered, unless the exception was raised from an error handler."
713+
got_request_exception.send(current_app._get_current_object(), exception=e)
714+
713715
if isinstance(e, HTTPException):
714716
code = HTTPStatus(e.code)
715717
if include_message_in_response:

0 commit comments

Comments
 (0)