Aller au contenu

Errors

See the errors and retries guide for the retry policy and practical handling.

Bases: Exception

Base class for every error raised by the Pennylane SDK.

Bases: PennylaneError

The request could not be completed (network issue, DNS failure...).

Bases: APIConnectionError

The request timed out before the API answered.

Bases: PennylaneError

The API answered with an error status code (4xx / 5xx).

Attributes:

Name Type Description
status_code int

HTTP status code of the response.

error_code

Machine-readable code from the body error field when present (e.g. "unprocessable_entity"). Some endpoints put a human message in error instead; both are preserved verbatim.

message

Best-effort human-readable message (message field, falling back to error, falling back to the raw body).

details

Optional structured details from the body details field (e.g. per-field validation errors).

body

The parsed JSON body, or None if the body was not JSON.

response

The raw :class:httpx.Response.

.. warning:: response.request carries the original request, including the Authorization header with your API token (and, for OAuth token calls, the client secret in the body). Never log the request verbatim; log status_code, error_code and message instead.

Bases: APIStatusError

400: malformed JSON, wrong types or unsupported fields.

Bases: APIStatusError

401: missing, invalid or expired API token.

Bases: APIStatusError

403: the token lacks the required scope for this endpoint.

Bases: APIStatusError

404: the resource does not exist or is not accessible.

Bases: APIStatusError

409: conflict, e.g. a duplicate of an existing document.

Bases: APIStatusError

422: the request is well-formed but fails business validation.

Bases: APIStatusError

429: rate limit exceeded (Company: 25 req/5s, Firm: 5 req/s).

Attributes:

Name Type Description
retry_after float | None

Seconds to wait before retrying, from the retry-after response header when present.

Bases: APIStatusError

5xx: transient Pennylane server error (500, 503...).