1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum MindatError {
8 #[error("HTTP request failed: {0}")]
10 Request(#[from] reqwest::Error),
11
12 #[error("Invalid URL: {0}")]
14 Url(#[from] url::ParseError),
15
16 #[error("API error (status {status}): {message}")]
18 Api { status: u16, message: String },
19
20 #[error("Failed to parse response: {0}")]
22 Deserialization(#[from] serde_json::Error),
23
24 #[error("Authentication required: please provide a valid API token")]
26 AuthenticationRequired,
27
28 #[error("Rate limit exceeded, please wait before making more requests")]
30 RateLimited,
31
32 #[error("Resource not found: {0}")]
34 NotFound(String),
35
36 #[error("Invalid parameter: {0}")]
38 InvalidParameter(String),
39}
40
41pub type Result<T> = std::result::Result<T, MindatError>;