Skip to content

Commit db1c609

Browse files
Mlaz-codeclaude
andauthored
feat(errors): add OFFSET_TOO_LARGE code (#3)
* feat(errors): add OFFSET_TOO_LARGE code an upstream change introduces a new HTTP 400 error code `offset_too_large` returned by /api/v1/odds and /api/v1/odds/delta when clients request offset > 500. Adding the canonical code here so consumers branching on errcode strings can recognize it. Mapped to ValidationError — clients treating the request as retriable with a corrected offset can handle it the same way they handle validation errors. Description points to cursor-based pagination and since-advancement as the structured alternatives. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style: wrap OFFSET_TOO_LARGE description to satisfy ruff E501 --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f9a597e commit db1c609

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/sharpapi/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class StreamError(SharpAPIError):
8383
MISSING_API_KEY = "missing_api_key"
8484
NOT_FOUND = "not_found"
8585
NOT_READY = "not_ready"
86+
OFFSET_TOO_LARGE = "offset_too_large"
8687
RATE_LIMITED = "rate_limited"
8788
SERVICE_UNAVAILABLE = "service_unavailable"
8889
TIER_RESTRICTED = "tier_restricted"
@@ -115,6 +116,10 @@ class StreamError(SharpAPIError):
115116
MISSING_API_KEY: "No API key provided.",
116117
NOT_FOUND: "Resource not found.",
117118
NOT_READY: "A required backing store is not yet ready to serve this request; retry shortly.",
119+
OFFSET_TOO_LARGE: (
120+
"offset exceeds the per-endpoint maximum; "
121+
"use cursor-based pagination or advance `since`."
122+
),
118123
RATE_LIMITED: "Rate limit exceeded; see Retry-After header.",
119124
SERVICE_UNAVAILABLE: "Service is temporarily unavailable.",
120125
TIER_RESTRICTED: "Current subscription tier does not include this feature.",
@@ -150,6 +155,7 @@ class StreamError(SharpAPIError):
150155
TOO_MANY_STREAMS: RateLimitedError,
151156
# Validation
152157
VALIDATION_ERROR: ValidationError,
158+
OFFSET_TOO_LARGE: ValidationError,
153159
# Streaming frames
154160
WS_ALREADY_AUTHENTICATED: StreamError,
155161
WS_INVALID_MESSAGE: StreamError,

0 commit comments

Comments
 (0)