app.errors¶
Domain exception classes and their FastAPI handler registration.
Domain errors are plain Python exceptions raised by the service
layer. Routers never translate built-in exceptions (ValueError,
KeyError) into HTTP responses; instead every error condition that
can cross a layer boundary gets its own exception class here, mapped
to an explicit HTTP status code by a registered handler.
Error bodies are {"detail": "<message>"}; errors constructed with
a machine-readable code add "code": "<code>" next to it (the
authentication and authorization errors always do). An optional
hint (what the caller or an operator can do about it) adds
"hint": "<hint>", and extra adds further JSON members (for
example the issues list of a refused candidate document).
- exception app.errors.AdrianoError(message, *, code=None, hint=None, extra=None)¶
Bases:
ExceptionBase class for all domain exceptions raised by the services.
- Parameters:
- body()¶
Build the JSON error body.
- exception app.errors.ConfigurationError(message, *, code=None, hint=None, extra=None)¶
Bases:
AdrianoErrorRaised when
catalog.yamlor a related setting is invalid.
- exception app.errors.NotFoundError(message, *, code=None, hint=None, extra=None)¶
Bases:
AdrianoErrorRaised when a requested catalog resource does not exist.
- exception app.errors.ConflictError(message, *, code=None, hint=None, extra=None)¶
Bases:
AdrianoErrorRaised when a write conflicts with existing state (HTTP 409).
- exception app.errors.DecisionExistsError(message, *, code=None, hint=None, extra=None)¶
Bases:
ConflictErrorRaised when the identity already has a decision for the digest.
- exception app.errors.CandidateExistsError(message, *, code=None, hint=None, extra=None)¶
Bases:
ConflictErrorRaised when a create-only candidate write finds an existing row.
- exception app.errors.DeliveryExistsError(message, *, code=None, hint=None, extra=None)¶
Bases:
ConflictErrorRaised when an intake run with the same delivery id exists.
- exception app.errors.ForbiddenError(message, *, code=None, hint=None, extra=None)¶
Bases:
AdrianoErrorRaised when the caller lacks permission for an action.
- exception app.errors.ValidationFailedError(message, *, code=None, hint=None, extra=None)¶
Bases:
AdrianoErrorRaised when submitted content fails validation (HTTP 422).
- exception app.errors.PayloadTooLargeError(message, *, code=None, hint=None, extra=None)¶
Bases:
AdrianoErrorRaised when a request body or document exceeds a limit (HTTP 413).
- exception app.errors.AuthenticationError(message, *, code, token_presented=True, hint=None)¶
Bases:
AdrianoErrorRaised when a request has no acceptable bearer token (HTTP 401).
The response carries
WWW-Authenticate: Bearer(RFC 6750), witherror="invalid_token"when a token was presented.- Parameters:
Bases:
AdrianoErrorRaised when the server cannot authenticate anyone (HTTP 503).
Either no authentication mechanism is configured, or the identity provider’s discovery document or keys cannot be fetched.