@@ -673,6 +673,18 @@ def error_router(self, original_handler, e):
673673 return original_handler (f )
674674 return original_handler (e )
675675
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+
676688 def handle_error (self , e ):
677689 """
678690 Error handler for the API transforms a raised exception into a Flask response,
@@ -685,10 +697,7 @@ def handle_error(self, e):
685697 # client if a handler is configured for the exception.
686698 if (
687699 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 ()
692701 and not isinstance (e , tuple (self ._own_and_child_error_handlers .keys ()))
693702 ):
694703 exc_type , exc_value , tb = sys .exc_info ()
0 commit comments