use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("authentication failed: invalid credentials or server error")]
Authentication,
#[error("environment variable `{0}` is not set")]
MissingEnvVar(&'static str),
#[error("missing required credential: {0}")]
MissingCredentials(&'static str),
#[error("failed to build HTTP client: {0}")]
HttpClient(#[source] reqwest::Error),
#[error("request failed: {0}")]
Request(#[source] reqwest::Error),
#[error("API error (status {status}): {body}")]
ApiError {
status: u16,
body: String,
},
#[error("failed to parse response: {source}")]
Parse {
#[source]
source: serde_json::Error,
body: String,
},
}