1 parent 5f49450 commit 1ec41a0Copy full SHA for 1ec41a0
1 file changed
app/controllers/errors.py
@@ -59,3 +59,17 @@ class PayloadTooLarge(DomainError):
59
"""Upload exceeds the configured limit (413)."""
60
61
status_code = 413
62
+
63
64
+class TooManyRequests(DomainError):
65
+ """Rate limit exceeded (429).
66
67
+ ``retry_after`` (seconds) is surfaced as a ``Retry-After`` header by
68
+ the app's error handler.
69
+ """
70
71
+ status_code = 429
72
73
+ def __init__(self, detail: str, retry_after: int = 1) -> None:
74
+ super().__init__(detail)
75
+ self.retry_after = retry_after
0 commit comments