File size: 678 Bytes
e2be33b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """Application errors. Each maps to an HTTP status and an error `code` in the API error schema (SRS §5.7)."""
from __future__ import annotations
class AppError(Exception):
code = "internal"
status = 500
class InvalidRequestError(AppError):
code = "invalid_request"
status = 400
class UnauthorizedError(AppError):
code = "unauthorized"
status = 401
class ForbiddenError(AppError):
code = "forbidden"
status = 403
class NotFoundError(AppError):
code = "not_found"
status = 404
class ConflictError(AppError):
code = "conflict"
status = 409
class RateLimitedError(AppError):
code = "rate_limited"
status = 429
|