use thiserror::Error;
#[derive(Debug, Error)]
pub enum ClickSendError {
#[error("http error: {0}")]
Http(#[from] reqwest::Error),
#[error("unauthorized — bad username or api key")]
Unauthorized,
#[error("not found: {0}")]
NotFound(String),
#[error("api error ({code}): {message}")]
Http4xx5xx {
code: u16,
message: String,
},
#[error("api error: {code} — {message}")]
Api {
code: String,
message: String,
body: String,
},
#[error("decode error: {message}\nbody: {body}")]
Decode {
message: String,
body: String,
},
#[error("rate limited (retry-after: {retry_after_secs:?}s)")]
RateLimited {
retry_after_secs: Option<u64>,
},
#[error("invalid config: {0}")]
InvalidConfig(String),
}