Exceptions¶
The HTTP exceptions CRUDAuth raises. All subclass CustomException, which is a FastAPI
HTTPException, so they propagate with the right status code and headers.
crudauth.exceptions.CustomException
¶
CustomException(
status_code: int = HTTP_500_INTERNAL_SERVER_ERROR,
detail: Any = None,
headers: dict[str, str] | None = None,
)
Bases: HTTPException
crudauth.exceptions.BadRequestException
¶
Bases: CustomException
crudauth.exceptions.OAuthAccountException
¶
Bases: BadRequestException
A 400 refusing an OAuth sign-in while resolving the account.
code is the machine-readable reason the OAuth callback reports as
error (email_missing, email_unverified, email_too_long,
provider_already_linked); detail is the human-readable message.
crudauth.exceptions.NotFoundException
¶
Bases: CustomException
crudauth.exceptions.ForbiddenException
¶
Bases: CustomException
crudauth.exceptions.UnauthorizedException
¶
Bases: CustomException
crudauth.exceptions.UnprocessableEntityException
¶
Bases: CustomException
crudauth.exceptions.DuplicateValueException
¶
Bases: CustomException
crudauth.exceptions.ValueTooLongException
¶
Bases: CustomException
A 422 in FastAPI's validation-error format, one string_too_long entry per field.
crudauth.exceptions.PasswordPolicyException
¶
Bases: CustomException
A 422 in FastAPI's validation-error format, one entry per unmet password rule.
crudauth.exceptions.RateLimitException
¶
RateLimitException(
detail: str | None = None,
retry_after: int | None = None,
headers: dict[str, str] | None = None,
)
Bases: CustomException
crudauth.exceptions.SudoLockoutError
¶
Bases: CustomException
Raised when too many wrong-password sudo attempts lock re-authentication.
Distinct from RateLimitException
(its own sudo:* counter, separate from login lockout) but shares the
429 + Retry-After shape.