Skip to main content

error handling

every error the sdk raises inherits from RumikError. handle the specific cases you can recover from, like a bad key or a rate limit, and keep RumikError as a backstop so nothing slips through unhandled.

the exception tree

every APIStatusError (the 4xx/5xx group) carries .status_code, .code, .request_id, and .response. RateLimitError adds .retry_after (seconds to wait). passing empty text raises a plain ValueError before any request is sent.
always log request_id so support can trace a failure.

account capacity

429 can also mean your account has reached its purchased concurrent-request capacity. in that case the response code is concurrency_limit_exceeded and the json response includes active_requests and limit:
wait for an active request to finish or increase account capacity. retrying immediately cannot create capacity and never triggers an automatic purchase.

configuration

set these once when you build the client. a few can be overridden per request where it makes sense.
retries happen automatically on 408, 429, and 5xx responses and on network errors, using jittered exponential backoff and honoring Retry-After. default_headers apply to every request; extra_headers apply to a single call. every response carries a .request_id from x-request-id.

debug logging

set RUMIK_LOG=debug to log every request, response, and retry:
debug logging never includes your api key.