Exceptions¶
Invalid arguments raise TypeError or ValueError. Unsuccessful HTTP responses
raise MermaidAPIError subclasses. An unusable response (including invalid JSON,
a malformed list/detail/choices response, or a malformed zonal result) raises
MermaidConnectionError, with the parsing exception retained as __cause__.
Transport failures also use MermaidConnectionError.
Paginated responses must contain a results array. Optional count must be a
non-negative integer or null; next must be a non-empty URL string or null.
Empty arrays remain valid, and unknown model fields are still preserved.
Worker and retry counts must be integers (booleans are rejected). Coordinates,
radii, and retry backoff must be finite; radii and backoff must also be non-negative.
Invalid STAC input shapes raise TypeError or ValueError during preparation.
Project and detail IDs share normalization: surrounding whitespace and slashes are trimmed, empty IDs and standalone dot path segments are rejected, and internal slashes remain percent-encoded as part of the ID.
exceptions
¶
Exception hierarchy for the MERMAID SDK.
Request and authentication failures derive from
MermaidError. Invalid caller arguments
raise standard TypeError or ValueError exceptions. HTTP failures are mapped to
dedicated subclasses
by raise_for_status.
Classes:
| Name | Description |
|---|---|
MermaidError |
Base class for request and authentication errors. |
MermaidConnectionError |
The request produced no usable response. |
AuthFlowError |
An interactive login could not be completed. |
AuthTimeoutError |
The user did not finish the login before the flow gave up. |
MermaidAPIError |
The API returned an unsuccessful HTTP status code. |
AuthenticationError |
The credentials are missing, invalid, or insufficient (401/403). |
NotFoundError |
The requested resource does not exist (404). |
RateLimitError |
The client is being throttled (429). |
ServerError |
The API failed to handle the request (5xx). |
Functions:
| Name | Description |
|---|---|
raise_for_status |
Raise the exception matching |
MermaidError
¶
Bases: Exception
Base class for request and authentication errors.
MermaidConnectionError
¶
Bases: MermaidError
The request produced no usable response.
Either no response came back (DNS, TLS, timeout, reset), or the body could not be used: it was not JSON, or not the shape the endpoint answers with.
AuthFlowError
¶
Bases: MermaidError
An interactive login could not be completed.
Distinct from AuthenticationError, which is the API
rejecting credentials that were sent. payload holds the OAuth error body when
the provider supplied one.
Attributes:
| Name | Type | Description |
|---|---|---|
payload |
dict[str, Any]
|
|
AuthTimeoutError
¶
Bases: AuthFlowError
The user did not finish the login before the flow gave up.
Attributes:
| Name | Type | Description |
|---|---|---|
payload |
dict[str, Any]
|
|
MermaidAPIError
¶
MermaidAPIError(
message: str,
*,
status_code: int,
url: str | None = None,
body: Any = None,
response: Response | None = None,
)
Bases: MermaidError
The API returned an unsuccessful HTTP status code.
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
|
|
url |
|
|
body |
|
|
response |
|
AuthenticationError
¶
AuthenticationError(
message: str,
*,
status_code: int,
url: str | None = None,
body: Any = None,
response: Response | None = None,
)
Bases: MermaidAPIError
The credentials are missing, invalid, or insufficient (401/403).
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
|
|
url |
|
|
body |
|
|
response |
|
NotFoundError
¶
NotFoundError(
message: str,
*,
status_code: int,
url: str | None = None,
body: Any = None,
response: Response | None = None,
)
Bases: MermaidAPIError
The requested resource does not exist (404).
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
|
|
url |
|
|
body |
|
|
response |
|
RateLimitError
¶
Bases: MermaidAPIError
The client is being throttled (429).
Attributes:
| Name | Type | Description |
|---|---|---|
retry_after |
|
|
status_code |
|
|
url |
|
|
body |
|
|
response |
|
ServerError
¶
ServerError(
message: str,
*,
status_code: int,
url: str | None = None,
body: Any = None,
response: Response | None = None,
)
Bases: MermaidAPIError
The API failed to handle the request (5xx).
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
|
|
url |
|
|
body |
|
|
response |
|
parse_retry_after
¶
Parse a Retry-After header into a delay in seconds.
Both forms allowed by RFC 9110 are understood: delta-seconds and an HTTP
date, which is converted into the seconds remaining from now. Anything
unparseable (or already in the past) yields None.
raise_for_status
¶
Raise the exception matching response's status code.
Successful (2xx) responses return None.