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.

BlockNotFoundError 1
A named template block does not exist in the target template. Raised at render time when a region …

A named template block does not exist in the target template.

Raised at render time when a region update (OOB fragment, Suspense deferred block, layout contract entry) references a block the template does not define. App-levelregister_oob_region(..., optional=True) is the opt-out for shell regions that may legitimately be absent from some layouts; non-optional misses reach here and propagate so they're visible rather than silently producing empty swaps.

Multi-inherits fromKeyError so existing except KeyErrorhandlers (including Kida's documentedrender_blockcontract) still catch it.

Methods

Internal Methods 1
__init__ 3
def __init__(self, *, template: str, block: str, region: str | None = None) -> None
Parameters
Name Type Description
template
block
region Default:None
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:''