Skip to main content

Error handling

The SDK exposes a small hierarchy of exceptions in simulacrum.exceptions. Handling them intentionally keeps your pipelines resilient.

Catching authentication failures

AuthError also covers the more specific ApiKeyInvalidError, ApiKeyInactiveError, and ApiKeyExpiredError. Use targeted handlers when you need bespoke remediation.

Handling invalid payloads

The SDK catches most client-side validation errors before the request is sent. When they leak through, the API raises InvalidRequestError and includes context in the message.

Dealing with quotas and concurrency

Quota errors include per-minute and per-day throttles. If retries keep failing, contact support to adjust limits.

Logging unexpected API errors

Forward the original exception to your logging or observability stack so you can debug response payloads later.