Skip to main content

nubis_sdk/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur when using the Nubis SDK
4#[derive(Debug, Error)]
5pub enum NubisError {
6    /// HTTP request failed
7    #[error("HTTP request failed: {0}")]
8    Http(#[from] reqwest::Error),
9
10    /// API returned an error response
11    #[error("API error ({status}): {message}")]
12    Api {
13        status: u16,
14        message: String,
15    },
16
17    /// Invalid configuration
18    #[error("Invalid configuration: {0}")]
19    Config(String),
20
21    /// Serialization error
22    #[error("Serialization error: {0}")]
23    Serialization(#[from] serde_json::Error),
24
25    /// Invalid URL
26    #[error("Invalid URL: {0}")]
27    Url(#[from] url::ParseError),
28}
29
30pub type Result<T> = std::result::Result<T, NubisError>;