Skip to main content

wishmaster_sdk/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum SdkError {
5    #[error("HTTP error: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("API error: {status} - {message}")]
9    Api { status: u16, message: String },
10
11    #[error("Authentication error: {0}")]
12    Auth(String),
13
14    #[error("Not found: {0}")]
15    NotFound(String),
16
17    #[error("Invalid state: {0}")]
18    InvalidState(String),
19
20    #[error("Serialization error: {0}")]
21    Serialization(#[from] serde_json::Error),
22
23    #[error("Configuration error: {0}")]
24    Config(String),
25
26    #[error("Internal error: {0}")]
27    Internal(String),
28}
29
30pub type Result<T> = std::result::Result<T, SdkError>;