Home / Function/ handle_url_build_error() — flask Function Reference

handle_url_build_error() — flask Function Reference

Architecture documentation for the handle_url_build_error() function in app.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  7f44d7e0_4d22_a6d6_507e_6cc8d2ef281a["handle_url_build_error()"]
  38f6d4a2_834e_2acd_e1b6_f45c58079ccd["App"]
  7f44d7e0_4d22_a6d6_507e_6cc8d2ef281a -->|defined in| 38f6d4a2_834e_2acd_e1b6_f45c58079ccd
  style 7f44d7e0_4d22_a6d6_507e_6cc8d2ef281a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/sansio/app.py lines 978–1010

    def handle_url_build_error(
        self, error: BuildError, endpoint: str, values: dict[str, t.Any]
    ) -> str:
        """Called by :meth:`.url_for` if a
        :exc:`~werkzeug.routing.BuildError` was raised. If this returns
        a value, it will be returned by ``url_for``, otherwise the error
        will be re-raised.

        Each function in :attr:`url_build_error_handlers` is called with
        ``error``, ``endpoint`` and ``values``. If a function returns
        ``None`` or raises a ``BuildError``, it is skipped. Otherwise,
        its return value is returned by ``url_for``.

        :param error: The active ``BuildError`` being handled.
        :param endpoint: The endpoint being built.
        :param values: The keyword arguments passed to ``url_for``.
        """
        for handler in self.url_build_error_handlers:
            try:
                rv = handler(error, endpoint, values)
            except BuildError as e:
                # make error available outside except block
                error = e
            else:
                if rv is not None:
                    return rv

        # Re-raise if called with an active exception, otherwise raise
        # the passed in exception.
        if error is sys.exc_info()[1]:
            raise

        raise error

Subdomains

Frequently Asked Questions

What does handle_url_build_error() do?
handle_url_build_error() is a function in the flask codebase, defined in src/flask/sansio/app.py.
Where is handle_url_build_error() defined?
handle_url_build_error() is defined in src/flask/sansio/app.py at line 978.

Analyze Your Own Codebase

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

Try Supermodel Free