API server exceptions — raised when yggdrasil is the server.
Unlike the HTTP client hierarchy (:mod:.http), these carry only a
detail string and status_code int — no Response object —
because they originate inside our own request handlers.
Both the bot and fastapi apps should raise these instead of defining
local duplicates. A single :func:register_exception_handlers wires
them into any FastAPI application.
APIError
APIError(detail: str = '', *, status_code: int | None = None)
Bases: YGGException
Base for every API-handler exception. Carries HTTP semantics.
BadRequestError
BadRequestError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
400 Bad Request.
UnauthorizedError
UnauthorizedError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
401 Unauthorized.
ForbiddenError
ForbiddenError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
403 Forbidden.
NotFoundError
NotFoundError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
404 Not Found.
MethodNotAllowedError
MethodNotAllowedError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
405 Method Not Allowed.
ConflictError
ConflictError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
409 Conflict.
TimeoutError
TimeoutError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
408 Request Timeout.
UnprocessableError
UnprocessableError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
422 Unprocessable Entity.
TooManyRequestsError
TooManyRequestsError(detail: str = '', *, status_code: int | None = None)
Bases: APIError
429 Too Many Requests.
register_api_exception_handlers
register_api_exception_handlers(app: 'FastAPI') -> None
Wire :class:APIError into a FastAPI app's exception handling.