pub enum Error {
Network(Error),
Http {
status: StatusCode,
body: String,
},
Decode {
message: String,
body: String,
},
Api {
message: String,
code: Option<String>,
errors: Vec<String>,
},
Configuration(String),
Validation(String),
}Expand description
All errors that can occur while using the Wema ALAT SDK.
The variants are ordered from “lowest level” (transport) to “highest level” (a perfectly well-formed HTTP exchange in which the bank reported a business failure inside the response envelope).
Variants§
Network(Error)
A transport-level failure from the underlying HTTP client (reqwest).
This means the request never produced a usable HTTP response: DNS could not be resolved, the connection timed out, TLS negotiation failed, etc. These are typically transient and safe to retry for idempotent reads (never blindly retry a transfer — use a status-check endpoint instead).
Http
The server returned a non-success HTTP status code (4xx/5xx).
The gateway itself rejected the request before (or instead of) producing
a business response — e.g. 401 Unauthorized (bad subscription/API key),
403 Forbidden (not subscribed to the product), 429 Too Many Requests,
or 500. The raw response body is preserved verbatim for diagnostics.
Fields
status: StatusCodeThe HTTP status code returned by the Azure APIM gateway.
Decode
The HTTP call succeeded (2xx) but the JSON body could not be decoded into the expected Rust type.
This usually signals a drift between this SDK’s models and the live API schema. The offending body (truncated) is included so the mismatch can be diagnosed without re-running the request.
Fields
Api
The bank reported a business failure inside an otherwise valid response.
The HTTP exchange was fine (2xx, well-formed JSON), but the response
envelope’s success flag was negative (hasError: true, successful: false, or status: false). Examples: “Invalid BVN”, “Insufficient
funds”, “Customer not found”. The human-readable message,
machine code, and any field-level errors
are surfaced directly from the envelope.
Fields
Configuration(String)
The SDK could not be configured or a request could not be constructed.
Raised before any network I/O — e.g. a subscription/API key that contains
bytes that are not valid in an HTTP header, or a required credential
(such as the bills/airtime access key) that was not supplied.
Validation(String)
Client-side validation rejected the input before a request was sent.
Used for fail-fast guards that save a doomed round-trip, such as an empty salt key when signing a transfer.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()