use thiserror::Error;
pub type Result<T> = std::result::Result<T, TrendError>;
#[derive(Debug, Error)]
pub enum TrendError {
#[error("database error: {0}")]
Db(#[from] rusqlite::Error),
#[error("fetch error: {0}")]
Fetch(#[from] fetch_kit::FetchError),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("rate limited after {attempts} attempts on {endpoint}")]
RateLimited {
endpoint: String,
attempts: u32,
},
#[error("config error: {0}")]
Config(String),
#[error("{0}")]
Other(String),
}