1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum LagoError {
5 #[error("HTTP request failed: {0}")]
6 Http(#[from] reqwest::Error),
7
8 #[error("Serialization error: {0}")]
9 Serialization(#[from] serde_json::Error),
10
11 #[error("API error: {status} - {message}")]
12 Api { status: u16, message: String },
13
14 #[error("Invalid configuration: {0}")]
15 Configuration(String),
16
17 #[error("Unauthorized: invalid API key")]
18 Unauthorized,
19
20 #[error("Rate limit exceeded")]
21 RateLimit,
22}
23
24pub type Result<T> = std::result::Result<T, LagoError>;