Skip to content

Errors

errors

The five exceptions this SDK raises, all rooted in SystemOneError.

RETRY_STATUSES module-attribute

RETRY_STATUSES = frozenset({408, 429, 500, 502, 503, 504})

SystemOneError

Bases: Exception

Base class for every error raised by this SDK.

Source code in system_one/errors.py
class SystemOneError(Exception):
    """Base class for every error raised by this SDK."""

APIError

Bases: SystemOneError

A non-2xx response. Inspect status rather than catching a per-status subclass.

Source code in system_one/errors.py
class APIError(SystemOneError):
    """A non-2xx response. Inspect `status` rather than catching a per-status subclass."""

    def __init__(
        self,
        message: str,
        *,
        status: int,
        body: str | None = None,
        retry_after: float | None = None,
    ) -> None:
        super().__init__(message)
        self.status = status
        self.body = body
        self.retry_after = retry_after

status instance-attribute

status = status

body instance-attribute

body = body

retry_after instance-attribute

retry_after = retry_after

AuthenticationError

Bases: APIError

A 401 or 403. A configuration problem, so it is never retried.

Source code in system_one/errors.py
class AuthenticationError(APIError):
    """A 401 or 403. A configuration problem, so it is never retried."""

APIConnectionError

Bases: SystemOneError, ConnectionError

The request never reached the server.

Source code in system_one/errors.py
class APIConnectionError(SystemOneError, ConnectionError):
    """The request never reached the server."""

APITimeoutError

Bases: APIConnectionError, TimeoutError

The request did not complete within the configured timeout.

Source code in system_one/errors.py
class APITimeoutError(APIConnectionError, TimeoutError):
    """The request did not complete within the configured timeout."""