Skip to content

Exceptions

default_404_exception_handler

default_404_exception_handler(request, exc)

Default 404 exception handler. Can be overloaded.

Source code in src/air/exception_handlers.py
11
12
13
14
15
16
17
18
19
20
21
def default_404_exception_handler(request: Request, exc: Exception) -> AirResponse:
    """Default 404 exception handler. Can be overloaded."""
    return AirResponse(
        mvpcss(
            Title("404 Not Found"),
            H1("404 Not Found"),
            P("The requested resource was not found on this server."),
            P(f"URL: {request.url}"),
        ),
        status_code=404,
    )

default_500_exception_handler

default_500_exception_handler(request, exc)

Default 500 exception handler. Can be overloaded.

Source code in src/air/exception_handlers.py
24
25
26
27
28
29
30
31
32
33
def default_500_exception_handler(request: Request, exc: Exception) -> AirResponse:
    """Default 500 exception handler. Can be overloaded."""
    return AirResponse(
        mvpcss(
            Title("500 Internal Server Error"),
            H1("500 Internal Server Error"),
            P("An internal server error occurred."),
        ),
        status_code=500,
    )