From 0dfd6990cabffc1327f8bf3ae196f859d53d6828 Mon Sep 17 00:00:00 2001 From: Mlaz-code <68407656+Mlaz-code@users.noreply.github.com> Date: Fri, 24 Apr 2026 11:24:02 -0400 Subject: [PATCH] feat(errors): add NOT_READY code Mirrors errcodes.NotReady ("not_ready") added upstream in sharp-api-go 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). --- src/sharpapi/exceptions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sharpapi/exceptions.py b/src/sharpapi/exceptions.py index 14c5d17..42c8fef 100644 --- a/src/sharpapi/exceptions.py +++ b/src/sharpapi/exceptions.py @@ -82,6 +82,7 @@ class StreamError(SharpAPIError): METHOD_NOT_ALLOWED = "method_not_allowed" MISSING_API_KEY = "missing_api_key" NOT_FOUND = "not_found" +NOT_READY = "not_ready" RATE_LIMITED = "rate_limited" SERVICE_UNAVAILABLE = "service_unavailable" TIER_RESTRICTED = "tier_restricted" @@ -113,6 +114,7 @@ class StreamError(SharpAPIError): METHOD_NOT_ALLOWED: "HTTP method not allowed on this endpoint.", MISSING_API_KEY: "No API key provided.", NOT_FOUND: "Resource not found.", + NOT_READY: "A required backing store is not yet ready to serve this request; retry shortly.", RATE_LIMITED: "Rate limit exceeded; see Retry-After header.", SERVICE_UNAVAILABLE: "Service is temporarily unavailable.", TIER_RESTRICTED: "Current subscription tier does not include this feature.", @@ -160,6 +162,7 @@ class StreamError(SharpAPIError): INTERNAL_ERROR: SharpAPIError, METHOD_NOT_ALLOWED: SharpAPIError, NOT_FOUND: SharpAPIError, + NOT_READY: SharpAPIError, SERVICE_UNAVAILABLE: SharpAPIError, UNKNOWN_ENDPOINT: SharpAPIError, UPSTREAM_ERROR: SharpAPIError,