Skip to content

Errors

The full OcxMirrorError hierarchy. See Guide → Error handling for the catch recipes.

OcxMirrorError

ocx_mirror_sdk.errors.OcxMirrorError

Bases: Exception

Base class for every exception raised from ocx_mirror_sdk.

Catch this to recover from any SDK-level failure::

try:
    list_releases("owner", "repo")
except OcxMirrorError as e:
    log.warning("SDK call failed: %s", e)

ConfigurationError

ocx_mirror_sdk.errors.ConfigurationError

Bases: OcxMirrorError

Required configuration is missing or invalid.

Examples: GITHUB_TOKEN not set when required, github3 client failed to initialize. Not retryable.

TransportError

ocx_mirror_sdk.errors.TransportError

Bases: OcxMirrorError

Base class for network / transport failures (retry candidates).

HttpStatusError

ocx_mirror_sdk.errors.HttpStatusError

HttpStatusError(*, status_code: int, url: str, response_text: str | None = None)

Bases: TransportError

An HTTP response carried a non-2xx status code.

ATTRIBUTE DESCRIPTION
status_code

HTTP status code.

url

Absolute request URL.

response_text

First 1000 chars of the response body, or None.

Source code in src/ocx_mirror_sdk/errors.py
def __init__(
    self,
    *,
    status_code: int,
    url: str,
    response_text: str | None = None,
) -> None:
    self.status_code = status_code
    self.url = url
    self.response_text = response_text
    super().__init__(f"HTTP {status_code} for {url}")

HttpTimeoutError

ocx_mirror_sdk.errors.HttpTimeoutError

HttpTimeoutError(*, url: str)

Bases: TransportError

The request did not complete within the configured timeout.

ATTRIBUTE DESCRIPTION
url

Absolute request URL.

Source code in src/ocx_mirror_sdk/errors.py
def __init__(self, *, url: str) -> None:
    self.url = url
    super().__init__(f"HTTP timeout for {url}")

ApiResponseError

ocx_mirror_sdk.errors.ApiResponseError

ApiResponseError(message: str = 'unusable API response', *, payload: object = None)

Bases: OcxMirrorError

The server responded but the payload is unusable.

Examples: malformed JSON, GraphQL errors array, REST repository not found.

ATTRIBUTE DESCRIPTION
payload

Raw payload echoed for diagnostics. None when there was no parseable body (e.g. JSON decode failure).

Source code in src/ocx_mirror_sdk/errors.py
def __init__(
    self,
    message: str = "unusable API response",
    *,
    payload: object = None,
) -> None:
    self.payload = payload
    super().__init__(message)

SchemaError

ocx_mirror_sdk.errors.SchemaError

SchemaError(message: str = 'schema mismatch', *, field: str | None = None)

Bases: OcxMirrorError

Input data did not match the expected schema.

Raised when :meth:Release.from_dict encounters missing or wrongly typed fields.

ATTRIBUTE DESCRIPTION
field

Name of the offending field, or None if unknown.

Source code in src/ocx_mirror_sdk/errors.py
def __init__(
    self,
    message: str = "schema mismatch",
    *,
    field: str | None = None,
) -> None:
    self.field = field
    if field:
        message = f"{message}: field={field!r}"
    super().__init__(message)

CacheError

ocx_mirror_sdk.errors.CacheError

CacheError(message: str = 'cache operation failed', *, path: Path | None = None)

Bases: OcxMirrorError

An on-disk cache operation failed.

Cache misses are not errors (see :meth:FileCache.get which returns None). This class is reserved for genuinely abnormal events: corrupt JSON, IO failure, permission denied.

ATTRIBUTE DESCRIPTION
path

The on-disk path that triggered the failure, or None.

Source code in src/ocx_mirror_sdk/errors.py
def __init__(
    self,
    message: str = "cache operation failed",
    *,
    path: Path | None = None,
) -> None:
    self.path = path
    if path is not None:
        message = f"{message}: path={path}"
    super().__init__(message)