ArmorError.
Exception Hierarchy
Import Exceptions
Exception Types
ArmorError
Base exception for all SDK errors.AuthenticationError
Raised when authentication fails (401).- Invalid API key
- Expired or revoked key
- Missing
Authorizationheader
AuthorizationError
Raised when authorization fails (403). The API key is valid but lacks permissions.- Using
read-onlykey for write operations - Using
read-writekey for admin operations
NotFoundError
Raised when a resource doesn’t exist (404).ValidationError
Raised when request parameters are invalid (422).RateLimitError
Raised when rate limit is exceeded (429).ServerError
Raised for server-side errors (5xx).StalenessError
Raised byrequire_fresh() when data is stale. This is a data quality exception, not an API error.
Best Practices
Catch Specific Exceptions
Retry with Backoff
Pipeline Gate Pattern
Debugging
Enable Request Logging
Inspect Error Details
Check API Key Validity
Common Questions
Which exception should I catch to fail a pipeline on stale data?
CatchStalenessError, which is raised by client.freshness.require_fresh(asset) when the asset is past its freshness threshold. It carries asset, hours_since_update, and threshold_hours so you can log actionable context. Let it propagate in Airflow tasks to mark the task failed cleanly.
How do I distinguish a transient server error from a permanent one?
CatchServerError (5xx) separately from ArmorError and retry with backoff; these are usually transient. ValidationError and NotFoundError are permanent for the given input, so retrying won’t help. The “Retry with Backoff” example above shows the pattern for 429 + 5xx specifically.
What’s the difference between AuthenticationError and AuthorizationError?
AuthenticationError (401) means the API key itself is missing, invalid, or revoked. AuthorizationError (403) means the key is valid but lacks the scope the endpoint requires. The latter exposes required_scope and current_scope attributes so you can point users at the right key to use.
How do I debug an unexpected error from the SDK?
Enable httpx debug logging (logging.getLogger("httpx").setLevel(logging.DEBUG)) to see the raw request and response, then inspect e.message, e.code, and e.details on the caught ArmorError. For ValidationError, e.field_errors points at the exact fields the API rejected.