1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum CufinderError {
6 #[error("HTTP request failed: {0}")]
7 HttpError(#[from] reqwest::Error),
8
9 #[error("JSON serialization/deserialization failed: {0}")]
10 JsonError(#[from] serde_json::Error),
11
12 #[error("API error: status {status}, message: {message}")]
13 ApiError { status: u16, message: String },
14
15 #[error("Validation error: {0}")]
16 ValidationError(String),
17
18 #[error("Authentication error: {0}")]
19 AuthenticationError(String),
20
21 #[error("Rate limit exceeded: {0}")]
22 RateLimitError(String),
23
24 #[error("Credit limit exceeded: {0}")]
25 CreditLimitError(String),
26
27 #[error("Network error: {0}")]
28 NetworkError(String),
29
30 #[error("Unknown error: {0}")]
31 UnknownError(String),
32}
33
34pub type Result<T> = std::result::Result<T, CufinderError>;