use thiserror::Error;
pub type Result<T> = std::result::Result<T, FlarerError>;
#[derive(Debug, Error)]
pub enum FlarerError {
#[error("HTTP transport error: {0}")]
Http(#[from] reqwest::Error),
#[error("Cloudflare API error (HTTP {status}): {body}")]
Api {
status: u16,
body: String,
},
#[error("authentication failed: {0}")]
Auth(String),
#[error("configuration error: {0}")]
Config(String),
#[error(transparent)]
Serde(#[from] serde_json::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("base64 decode error: {0}")]
Base64(#[from] base64::DecodeError),
#[error("invalid URL: {0}")]
Url(#[from] url::ParseError),
#[error("unexpected response: {0}")]
Unexpected(String),
}