use thiserror::Error;
#[derive(Error, Debug)]
pub enum ApiError {
#[error("Failed to create HTTP client: {0}")]
ClientCreationError(String),
#[error("HTTP request failed: {0}")]
RequestError(#[from] reqwest::Error),
#[error("Failed to deserialize response: {0}")]
DeserializationError(String),
#[error("API error (status {status}): {message}")]
ApiError { status: u16, message: String },
#[error("Invalid input: {0}")]
ValidationError(String),
}
impl From<serde_json::Error> for ApiError {
fn from(err: serde_json::Error) -> Self {
ApiError::DeserializationError(err.to_string())
}
}