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.

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.