Module

errors

Chirp exception hierarchy.

Shared across Router, App, handler, and middleware so every module raises and catches the same types.

Classes

ChirpError 0
Base for all chirp-specific errors.

Base for all chirp-specific errors.

ConfigurationError 0
Raised when app configuration is invalid. Typically caught during ``App._freeze()`` at startup.

Raised when app configuration is invalid.

Typically caught duringApp._freeze()at startup.

HTTPError 4
An error that maps directly to an HTTP status code. Raised by the router, middleware, or handlers.…

An error that maps directly to an HTTP status code.

Raised by the router, middleware, or handlers. The ASGI handler catches these and dispatches to the matching@app.error()handler.

Attributes

Name Type Description
status int
detail str
headers tuple[tuple[str, str], ...]

Methods

Internal Methods 1
__str__ 0 str
def __str__(self) -> str
Returns
str
NotFound 1
404 — no route matched the request path.

404 — no route matched the request path.

Methods

Internal Methods 1
__init__ 1
def __init__(self, detail: str = 'Not Found') -> None
Parameters
Name Type Description
detail Default:'Not Found'
MethodNotAllowed 1
405 — route exists but not for this HTTP method. Includes an ``Allow`` header listing the valid me…

405 — route exists but not for this HTTP method.

Includes anAllowheader listing the valid methods and embeds the allowed methods in the detail string for developer visibility.

Methods

Internal Methods 1
__init__ 2
def __init__(self, allowed: frozenset[str], detail: str = '') -> None
Parameters
Name Type Description
allowed
detail Default:''