Structured error returned from the Wise Platform API.
All API errors are returned as {:error, %Wise.Error{}} tuples.
Network errors are returned as {:error, %Wise.Error{type: :network}}.
Fields
type-:api,:network,:circuit_open,:invalid_signature,:rate_limitedstatus_code- HTTP status code (nil for network errors)code- Wise machine-readable error code e.g."SCA_REQUIRED"message- Human-readable descriptionerrors- Per-field validation errors (populated on 422)request_id- X-Request-Id header value for Wise support
Example
case Wise.Transfers.fund(client, profile_id, transfer_id) do
{:ok, result} -> result
{:error, %Wise.Error{code: "SCA_REQUIRED"}} -> redirect_to_sca()
{:error, %Wise.Error{status_code: 429}} -> handle_rate_limit()
{:error, %Wise.Error{type: :network}} -> handle_network_error()
end
Summary
Functions
Returns true if the circuit breaker rejected the request.
Extracts per-field validation errors from a 422 response.
Returns true if this is a network-level error.
Returns true if this is a 404 Not Found error.
Returns true if this is a 429 rate limit error.
Returns true if SCA (Strong Customer Authentication) is required.
Returns true if this is a 5xx server error.
Returns true if this is a 401 Unauthorized error.
Types
@type error_type() ::
:api | :network | :circuit_open | :invalid_signature | :rate_limited
@type t() :: %Wise.Error{ __exception__: true, code: String.t() | nil, errors: [field_error()], message: String.t() | nil, request_id: String.t() | nil, status_code: non_neg_integer() | nil, type: error_type() }
Functions
Returns true if the circuit breaker rejected the request.
@spec field_errors(t()) :: [field_error()]
Extracts per-field validation errors from a 422 response.
Returns true if this is a network-level error.
Returns true if this is a 404 Not Found error.
Returns true if this is a 429 rate limit error.
Returns true if SCA (Strong Customer Authentication) is required.
Returns true if this is a 5xx server error.
Returns true if this is a 401 Unauthorized error.