use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid input: {0}")]
InvalidInput(String),
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("server returned {code} for {url}")]
Status { code: u16, url: String },
#[error("not found: {0}")]
NotFound(String),
#[error("rate limited")]
RateLimited,
#[error("deserialize error: {source} — body: {body}")]
Deserialize {
source: serde_json::Error,
body: String,
},
#[error("response body exceeded the 10 MB size limit")]
ResponseTooLarge,
#[error("request timed out")]
Timeout,
#[error("URL error: {0}")]
Url(#[from] url::ParseError),
}
pub type Result<T> = std::result::Result<T, Error>;