Errors
Every exception this package raises inherits
auradefi.errors.AuradefiError, so one except clause
catches all of them and nothing else. Catching a narrower type is how you
distinguish a caller mistake from an upstream failure.
The HTTP status column is what the API shell returns for
that type. Three of them deliberately disagree with their parent:
ScopeError is 403 though it subclasses a 401,
CursorError is 422 though it subclasses a 500: because the
status describes whose fault it is, not where the class sits.
Two error types are about the offline guarantee rather than your data:
CassetteError and CassetteMissError mean a replayed
recording did not contain a request. In Sandbox that means you asked for
something the recording does not hold: not that a credential is missing. See
Authentication & keys.
| Error | Subclass of | HTTP | Raised when |
|---|---|---|---|
AuradefiError | none | 500 | Base class for every error raised by auradefi. |
AssetConflictError | AuradefiError | 500 | Registration would bind an existing CAIP-19 to a different asset. |
AuthError | AuradefiError | 401 | Credential or token failed authentication. |
CassetteError | AuradefiError | 500 | A cassette file is missing, malformed, or unreadable. |
ConfigError | AuradefiError | 500 | Invalid or missing configuration. |
ConflictError | AuradefiError | 409 | Create or update conflicts with existing state. |
CurrencyMismatchError | AuradefiError | 500 | Arithmetic across Money values of different currencies. |
DecimalsMismatchError | AuradefiError | 500 | Arithmetic or aggregation across quantities of unequal decimals. |
DecodeError | AuradefiError | 500 | Raw records for one transaction are mutually inconsistent or do not |
LedgerError | AuradefiError | 500 | Base class for persistence-layer failures. |
NotFoundError | AuradefiError | 404 | The entity does not exist within the caller's tenant scope. |
QuotaExceededError | AuradefiError | 429 | A tenant exhausted its quota window. |
SourceError | AuradefiError | 502 | A chain, explorer, or price source failed or returned malformed data. |
UnknownAssetError | AuradefiError | 500 | An asset id or CAIP-19 is not in the asset registry. |
UnknownChainError | AuradefiError | 500 | A chain id is syntactically valid but not in the chain registry. |
ValidationError | AuradefiError | 422 | Input failed validation before any work was attempted. |
CaipParseError | ValidationError | 422 | A CAIP-2 or CAIP-19 identifier could not be parsed. |
CassetteMissError | CassetteError | 500 | An HTTP request had no matching interaction in the loaded cassette. |
CursorError | LedgerError | 422 | A sync cursor is malformed or belongs to a different ledger. |
ScopeError | AuthError | 403 | The credential lacks the scope this operation requires. |
TenantIsolationError | LedgerError | 500 | A call attempted to cross a tenant boundary. |
TokenExpiredError | AuthError | 401 | A JWT's exp (ms epoch) is in the past. |
TokenRevokedError | AuthError | 401 | A JWT's jti is in the revocation set (SPEC §7.2). |
Over HTTP
Every failure is one shape, so a client parses one shape:
{
"error": {
"type": "ValidationError",
"message": "request validation failed",
"status": 422
}
}
A 409 also carries existing_connection_id, and a 429 carries a
Retry-After header in whole seconds. Source:
errors.py,
api/errors.py.