Represents a ClearBank API error.
Fields
:status- HTTP status code (e.g.,400,409,429):code- ClearBank error code string if available:message- Human-readable error description:details- Raw error map from the API response body:request_id- TheX-Request-Idfrom the original request:correlation_id- TheX-Correlation-Idreturned by ClearBank (store for support)
Common status codes
400- Bad request (invalid payload, missing required field)401- Unauthorised (invalid/expired API token)403- Forbidden404- Not found409- Conflict (duplicateX-Request-Id)422- Unprocessable entity429- Rate limited (back off and retry)500- Internal server error (retry with same X-Request-Id)503- Service unavailable (checkRetry-Afterheader and retry)
Summary
Functions
Builds a generic %ClearBank.Error{} from an exception or reason.
Builds a %ClearBank.Error{} from a response map (status + headers + body).
Accepts any struct or map with :status, :headers, :body fields.
Returns true if the error is retryable (5xx or 429).
Types
Functions
Builds a generic %ClearBank.Error{} from an exception or reason.
Builds a %ClearBank.Error{} from a response map (status + headers + body).
Accepts any struct or map with :status, :headers, :body fields.
Returns true if the error is retryable (5xx or 429).