Skip to content

Error handling

Everything the library raises derives from AtonixError, so one except catches it all. HTTP failures map to specific subclasses:

Exception Raised for
AuthenticationError 401: bad API key, bad signature, or clock skew
PermissionDeniedError 403
NotFoundError 404
RateLimitError 429, after all retries
ServerError 5xx, after all retries
APIError Other non-success responses and network failures
QuerySizeError A process data read over the point limit with chunk=False
from atonix import AtonixError, NotFoundError

try:
    details = client.assets.get_asset_details("asset-guid")
except NotFoundError:
    details = None
except AtonixError as e:
    print(f"Atonix call failed: {e}")
    raise

Retries

429 and 5xx responses are retried with backoff before an exception is raised. Set the number of attempts with max_retries on the client (default 3; 0 turns retries off).

Inspecting APIError

APIError carries the HTTP status and raw body when there is one:

from atonix import APIError

try:
    ...
except APIError as e:
    print(e.status_code, e.response_content)

QuerySizeError and ValueError

QuerySizeError also subclasses ValueError, so older code that caught ValueError for oversized reads keeps working.