Home / Function/ abort() — flask Function Reference

abort() — flask Function Reference

Architecture documentation for the abort() function in helpers.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  b9b84ab9_98c4_a2e5_8fe9_84f48c396213["abort()"]
  881f9803_28d6_7d77_c8d7_1098b41ccf84["helpers.py"]
  b9b84ab9_98c4_a2e5_8fe9_84f48c396213 -->|defined in| 881f9803_28d6_7d77_c8d7_1098b41ccf84
  style b9b84ab9_98c4_a2e5_8fe9_84f48c396213 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/helpers.py lines 268–288

def abort(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:
    """Raise an :exc:`~werkzeug.exceptions.HTTPException` for the given
    status code.

    If :data:`~flask.current_app` is available, it will call its
    :attr:`~flask.Flask.aborter` object, otherwise it will use
    :func:`werkzeug.exceptions.abort`.

    :param code: The status code for the exception, which must be
        registered in ``app.aborter``.
    :param args: Passed to the exception.
    :param kwargs: Passed to the exception.

    .. versionadded:: 2.2
        Calls ``current_app.aborter`` if available instead of always
        using Werkzeug's default ``abort``.
    """
    if (ctx := _cv_app.get(None)) is not None:
        ctx.app.aborter(code, *args, **kwargs)

    _wz_abort(code, *args, **kwargs)

Subdomains

Frequently Asked Questions

What does abort() do?
abort() is a function in the flask codebase, defined in src/flask/helpers.py.
Where is abort() defined?
abort() is defined in src/flask/helpers.py at line 268.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free