use thiserror::Error;
#[derive(Debug, Error)]
pub enum WikiError {
#[error("network error: {0}")]
Network(#[from] reqwest::Error),
#[error("parse error: {0}")]
Parse(#[from] serde_json::Error),
#[error("article not found: '{0}'")]
NotFound(String),
#[error("API error: {0}")]
Api(String),
#[error("config error: {0}")]
Config(String),
#[error("invalid color '{0}': expected #RRGGBB or #RGB")]
InvalidColor(String),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("{0}")]
Other(String),
}
impl From<confy::ConfyError> for WikiError {
fn from(e: confy::ConfyError) -> Self {
WikiError::Config(e.to_string())
}
}