Skip to content

Errors

Errors the client raises, importable from crucible.

from crucible import CrucibleAPIError, NotSignedInError, RemovedError

try:
    client.datasets.get(dataset_mfid)
except CrucibleAPIError as exc:
    print(exc.status, exc.code, exc.detail, exc.request_id)

CrucibleAPIError is raised when the API answers with an error status. It subclasses requests.HTTPError, so existing handlers keep working. Quote request_id when reporting a problem.

NotSignedInError is raised when a client is created without an API key or a stored sign-in for its API URL; run crucible login or set api_key. It subclasses ValueError.

RemovedError is raised when code calls a method, parameter, or setting removed in 4.0.0. It subclasses TypeError, and its message names the replacement.

crucible.errors.CrucibleAPIError

The API answered with an error status.

A subclass of requests.HTTPError, so existing handlers keep working.

Attributes:

Name Type Description
status

HTTP status code.

code

The API's machine-readable error code (detail.code), if any.

detail

The API's error detail: a message string, or the detail object.

request_id

The API's X-Request-ID for this request; quote it when reporting a problem so it can be found in the server logs.

crucible.errors.NotSignedInError

No API key or stored sign-in for the API URL.

crucible.errors.RemovedError

A method, parameter, or setting that was removed; the message names its replacement.