Skip to content

Commit f9a597e

Browse files
authored
feat(errors): add NOT_READY code (#4)
Mirrors NotReady ("not_ready") added upstream server-side for the 503 emitted when a backing store (e.g. ClickHouse, closing-line capture) isn't yet ready to serve the request. Maps to SharpAPIError via the fall-through branch (same recovery as SERVICE_UNAVAILABLE).
1 parent 2ae66b5 commit f9a597e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/sharpapi/exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class StreamError(SharpAPIError):
8282
METHOD_NOT_ALLOWED = "method_not_allowed"
8383
MISSING_API_KEY = "missing_api_key"
8484
NOT_FOUND = "not_found"
85+
NOT_READY = "not_ready"
8586
RATE_LIMITED = "rate_limited"
8687
SERVICE_UNAVAILABLE = "service_unavailable"
8788
TIER_RESTRICTED = "tier_restricted"
@@ -113,6 +114,7 @@ class StreamError(SharpAPIError):
113114
METHOD_NOT_ALLOWED: "HTTP method not allowed on this endpoint.",
114115
MISSING_API_KEY: "No API key provided.",
115116
NOT_FOUND: "Resource not found.",
117+
NOT_READY: "A required backing store is not yet ready to serve this request; retry shortly.",
116118
RATE_LIMITED: "Rate limit exceeded; see Retry-After header.",
117119
SERVICE_UNAVAILABLE: "Service is temporarily unavailable.",
118120
TIER_RESTRICTED: "Current subscription tier does not include this feature.",
@@ -160,6 +162,7 @@ class StreamError(SharpAPIError):
160162
INTERNAL_ERROR: SharpAPIError,
161163
METHOD_NOT_ALLOWED: SharpAPIError,
162164
NOT_FOUND: SharpAPIError,
165+
NOT_READY: SharpAPIError,
163166
SERVICE_UNAVAILABLE: SharpAPIError,
164167
UNKNOWN_ENDPOINT: SharpAPIError,
165168
UPSTREAM_ERROR: SharpAPIError,

0 commit comments

Comments
 (0)