@@ -673,6 +673,18 @@ def error_router(self, original_handler, e):
673
673
return original_handler (f )
674
674
return original_handler (e )
675
675
676
+ def _propagate_exceptions (self ):
677
+ """
678
+ Returns the value of the ``PROPAGATE_EXCEPTIONS`` configuration
679
+ value in case it's set, otherwise return true if app.debug or
680
+ app.testing is set. This method was deprecated in Flask 2.3 but
681
+ we still need it for our error handlers.
682
+ """
683
+ rv = current_app .config .get ("PROPAGATE_EXCEPTIONS" )
684
+ if rv is not None :
685
+ return rv
686
+ return current_app .testing or current_app .debug
687
+
676
688
def handle_error (self , e ):
677
689
"""
678
690
Error handler for the API transforms a raised exception into a Flask response,
@@ -685,10 +697,7 @@ def handle_error(self, e):
685
697
# client if a handler is configured for the exception.
686
698
if (
687
699
not isinstance (e , HTTPException )
688
- and (
689
- current_app .config .get ("PROPAGATE_EXCEPTIONS" )
690
- or (current_app .testing or current_app .debug )
691
- )
700
+ and self ._propagate_exceptions ()
692
701
and not isinstance (e , tuple (self ._own_and_child_error_handlers .keys ()))
693
702
):
694
703
exc_type , exc_value , tb = sys .exc_info ()
0 commit comments