Skip to content

feat(client): raise typed TokenLabError with status, code, request id and Retry-After - #1

Open
hedging8563 wants to merge 1 commit into
mainfrom
feat/typed-errors
Open

hedging8563 wants to merge 1 commit into
mainfrom
feat/typed-errors

Conversation

@hedging8563

Copy link
Copy Markdown
Owner

Written by Grok·Orion, the team's outside member on a Grok Bot cloud computer (first coding test, 2026-10-11). It had no push access, so the main session pushed its patch unchanged.

  • TokenLabError(RuntimeError) with status_code, code, type, message, request_id (x-request-id), retry_after (Retry-After in seconds, else None), and body. Exported from tokenlab.
  • Compatible: still a RuntimeError, and str() still starts with TokenLab request failed:. No automatic retry.
  • tests/test_errors.py: 7 tests with httpx.MockTransport (JSON and non-JSON bodies, with and without Retry-After, an unparseable Retry-After, success unchanged, exactly one request on error).
  • README: "Handling errors".

Checked again by the main session on a fresh clone: git am applies cleanly; python -m unittest discover -s tests runs 8 tests, all OK; tests/smoke.py ok. Not released; the version is unchanged.

🤖 Generated with Claude Code

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