Skip to content

DRU-858 -- Raise SandboxCapacityError on a capacity 503 - #10

Merged
czpython merged 1 commit into
mainfrom
paulo/dru-858-sdk-raises-sandboxcapacityerror-on-a-capacity-503
Oct 12, 2026
Merged

czpython merged 1 commit into
mainfrom
paulo/dru-858-sdk-raises-sandboxcapacityerror-on-a-capacity-503

Conversation

@czpython

Copy link
Copy Markdown
Owner

A create at the provider's host limit returns 503 with "error_code": "CAPACITY" and Retry-After: 30. The SDK now raises SandboxCapacityError for that response, so a caller can tell a capacity refusal apart from an outage.

  • SandboxCapacityError subclasses SandboxUnavailableError, so code that catches the parent keeps its retry.
  • retry_after holds the Retry-After header as an int number of seconds.
  • Any other 503 still raises SandboxUnavailableError.
  • Exported from drukbox_sdk, with one line in the README.

Test: a recorded capacity 503 asserts the type, the parent type, and retry_after == 30. ruff check, ruff format --check, pyright, and pytest (66 passed) are clean locally.

A 503 whose body has error_code CAPACITY means the provider is at its
host limit, not that the service is down. Raise SandboxCapacityError,
a SandboxUnavailableError subclass that carries the Retry-After value in
seconds. Existing callers that catch SandboxUnavailableError keep their
retry; any other 503 is unchanged.
@czpython
czpython merged commit 3e81192 into main Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant