Skip to main content

circle_user_controlled_wallets/
error.rs

1//! Error types for the `circle-user-controlled-wallets` crate.
2
3/// Errors that can occur when calling the Circle User-Controlled Wallets API.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    /// HTTP transport error from the underlying HTTP client.
7    #[error("HTTP transport error: {0}")]
8    Http(String),
9
10    /// The Circle API returned a non-2xx response with an error payload.
11    #[error("Circle API error {code}: {message}")]
12    Api {
13        /// Numeric error code from the Circle API response body.
14        code: i32,
15        /// Human-readable error message from the Circle API response body.
16        message: String,
17    },
18
19    /// Failed to deserialize the API response JSON into the expected type.
20    #[error("Failed to deserialize response: {0}")]
21    Deserialize(#[from] serde_json::Error),
22
23    /// A caller-supplied parameter was invalid before the request was sent.
24    #[error("Invalid parameter: {0}")]
25    InvalidParam(String),
26}