#[derive(Debug, thiserror::Error)]
pub enum DataError {
#[error("network error: {0}")]
Transport(String),
#[error("upstream returned HTTP {status}: {message}")]
Status {
status: u16,
message: String,
},
#[error("failed to decode response: {0}")]
Decode(String),
#[error("rate limited by upstream")]
RateLimited {
retry_after: Option<u64>,
},
#[error("missing API key for the {0} provider")]
MissingKey(&'static str),
#[error("operation not supported by the {provider} provider: {what}")]
Unsupported {
provider: &'static str,
what: &'static str,
},
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, DataError>;