use std::{fmt, io};
#[derive(Debug)]
pub enum PersonaConfigError {
Io(io::Error),
Json(serde_json::Error),
}
impl fmt::Display for PersonaConfigError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Io(error) => write!(formatter, "failed to read persona config: {error}"),
Self::Json(error) => write!(formatter, "failed to parse persona config: {error}"),
}
}
}
impl std::error::Error for PersonaConfigError {}
impl From<io::Error> for PersonaConfigError {
fn from(error: io::Error) -> Self {
Self::Io(error)
}
}
impl From<serde_json::Error> for PersonaConfigError {
fn from(error: serde_json::Error) -> Self {
Self::Json(error)
}
}