Module

_errors

Error hierarchy for pounce.

All pounce errors inherit from PounceError. Each error maps to an HTTP status code for automatic error response generation.

Error categories:

  • ParseError: malformed HTTP from the client (400)
  • RequestTimeoutError: request or keep-alive timeout (408)
  • LimitError: headers or body exceed configured limits (413/431)
  • AppError: the ASGI application raised an exception (500)
  • LifespanError: lifespan startup or shutdown failure (500)
  • SupervisorError: worker spawn or crash-restart failure (500)
  • WorkerError: worker-level failure reported to supervisor (500)
  • TLSError: TLS configuration or handshake failure (500)
  • ReloadError: file-watcher or worker-restart failure during reload (500)

Every error carries a semanticcode of the form POUNCE_<CATEGORY>_<SPECIFIC> and an optionalhintwith actionable remediation. See docs/design/error-codes.md for the naming scheme.

Classes

PounceError 4
Base exception for all pounce server errors.

Base exception for all pounce server errors.

Attributes

Name Type Description
status_code int
default_code str

Methods

Internal Methods 2
__init__ 5
def __init__(self, message: str, *, status_code: int | None = None, code: str | None = None, hint: str | None = None, doc: str | None = None) -> None
Parameters
Name Type Description
message
status_code Default:None
code Default:None
hint Default:None
doc Default:None
__reduce__ 0 tuple[object, ...]
def __reduce__(self) -> tuple[object, ...]
Returns
tuple[object, ...]
ParseError 2
Malformed HTTP request — h11 could not parse the input.

Malformed HTTP request — h11 could not parse the input.

Attributes

Name Type Description
status_code int
default_code str
RequestTimeoutError 2
Request or keep-alive timeout exceeded. Named ``RequestTimeoutError`` to avoid shadowing the built…

Request or keep-alive timeout exceeded.

NamedRequestTimeoutErrorto avoid shadowing the builtin TimeoutError (which is a subclass of OSError).

Attributes

Name Type Description
status_code int
default_code str
LimitError 2
Request headers or body exceed configured size limits. Default status is 413 (Content Too Large). …

Request headers or body exceed configured size limits.

Default status is 413 (Content Too Large). Passstatus_code=431 for header-specific limits (Request Header Fields Too Large).

Attributes

Name Type Description
status_code int
default_code str
AppError 2
The ASGI application raised an unhandled exception.

The ASGI application raised an unhandled exception.

Attributes

Name Type Description
status_code int
default_code str
LifespanError 2
ASGI lifespan startup or shutdown failed.

ASGI lifespan startup or shutdown failed.

Attributes

Name Type Description
status_code int
default_code str
SupervisorError 2
Worker spawn failure or crash-restart exhaustion.

Worker spawn failure or crash-restart exhaustion.

Attributes

Name Type Description
status_code int
default_code str
WorkerError 2
Worker-level failure that bubbles to the supervisor.

Worker-level failure that bubbles to the supervisor.

Attributes

Name Type Description
status_code int
default_code str
TLSError 2
TLS configuration or handshake failure.

TLS configuration or handshake failure.

Attributes

Name Type Description
status_code int
default_code str
ReloadError 2
File-watcher or worker-restart failure during reload.

File-watcher or worker-restart failure during reload.

Attributes

Name Type Description
status_code int
default_code str