use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
Json(serde_json::Error),
Regex(regex::Error),
Username(String),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::Json(e) => write!(f, "JSON error: `{e}`"),
Self::Regex(e) => write!(f, "Could not parse regex expression `{e}`"),
Self::Username(pattern) => write!(f, "Username does not match pattern `{pattern}`"),
}
}
}