Structured error type returned by all Marqeta API functions.
Error types
| Type | HTTP status | Retryable? |
|---|---|---|
:validation_error | 400, 422 | No |
:authentication_error | 401 | No |
:authorization_error | 403 | No |
:not_found | 404 | No |
:conflict_error | 409 | No |
:rate_limit_error | 429 | Yes |
:server_error | 500+ | Yes |
:network_error | — | Yes |
:timeout_error | — | Yes |
:decode_error | — | No |
:api_error | other | No |
:unknown_error | — | No |
Fields
:type— error type atom (see table above):message— human-readable error message:http_status— HTTP status code (when applicable):error_code— Marqeta error code string (e.g."400040"):request_id— Marqeta request correlation ID fromx-request-idheader:field_errors— list of field-level validation errors:retryable?— whether this error is safe to retry:raw— raw response body or original exception
Summary
Functions
Builds a Marqeta.Error from a network or transport exception.
Builds a Marqeta.Error from a parsed HTTP response.
Types
@type error_type() ::
:api_error
| :authentication_error
| :authorization_error
| :conflict_error
| :decode_error
| :network_error
| :not_found
| :rate_limit_error
| :server_error
| :timeout_error
| :unknown_error
| :validation_error
@type t() :: %Marqeta.Error{ __exception__: true, error_code: String.t() | nil, field_errors: [field_error()], http_status: non_neg_integer() | nil, message: String.t(), raw: term(), request_id: String.t() | nil, retryable?: boolean(), type: error_type() }
Functions
Builds a Marqeta.Error from a network or transport exception.
@spec from_response(%{body: term(), headers: headers(), status: non_neg_integer()}) :: t()
Builds a Marqeta.Error from a parsed HTTP response.
headers may be a keyword list of {name, value} tuples (as returned by
Finch / Req) or a map of name => value strings.