handle_http_exception() — flask Function Reference
Architecture documentation for the handle_http_exception() function in app.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 8f350fa4_a679_30fa_08ca_b4da93c5698c["handle_http_exception()"] 9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5["Flask"] 8f350fa4_a679_30fa_08ca_b4da93c5698c -->|defined in| 9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5 0b9edff8_7a0a_5286_0e0e_b7d04e6a35e6["handle_user_exception()"] 0b9edff8_7a0a_5286_0e0e_b7d04e6a35e6 -->|calls| 8f350fa4_a679_30fa_08ca_b4da93c5698c a89c0022_4807_bf16_9be1_6a66f3c78c9f["ensure_sync()"] 8f350fa4_a679_30fa_08ca_b4da93c5698c -->|calls| a89c0022_4807_bf16_9be1_6a66f3c78c9f style 8f350fa4_a679_30fa_08ca_b4da93c5698c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/app.py lines 829–862
def handle_http_exception(
self, ctx: AppContext, e: HTTPException
) -> HTTPException | ft.ResponseReturnValue:
"""Handles an HTTP exception. By default this will invoke the
registered error handlers and fall back to returning the
exception as response.
.. versionchanged:: 1.0.3
``RoutingException``, used internally for actions such as
slash redirects during routing, is not passed to error
handlers.
.. versionchanged:: 1.0
Exceptions are looked up by code *and* by MRO, so
``HTTPException`` subclasses can be handled with a catch-all
handler for the base ``HTTPException``.
.. versionadded:: 0.3
"""
# Proxy exceptions don't have error codes. We want to always return
# those unchanged as errors
if e.code is None:
return e
# RoutingExceptions are used internally to trigger routing
# actions, such as slash redirects raising RequestRedirect. They
# are not raised or handled in user code.
if isinstance(e, RoutingException):
return e
handler = self._find_error_handler(e, ctx.request.blueprints)
if handler is None:
return e
return self.ensure_sync(handler)(e) # type: ignore[no-any-return]
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does handle_http_exception() do?
handle_http_exception() is a function in the flask codebase, defined in src/flask/app.py.
Where is handle_http_exception() defined?
handle_http_exception() is defined in src/flask/app.py at line 829.
What does handle_http_exception() call?
handle_http_exception() calls 1 function(s): ensure_sync.
What calls handle_http_exception()?
handle_http_exception() is called by 1 function(s): handle_user_exception.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free