use figment::Error as FigmentError;
use super::OrthoError;
#[cfg(feature = "serde_json")]
impl From<serde_json::Error> for OrthoError {
fn from(e: serde_json::Error) -> Self {
let figment_err = <figment::Error as serde::de::Error>::custom(&e);
Self::Gathering(Box::new(figment_err))
}
}
impl From<clap::Error> for OrthoError {
fn from(e: clap::Error) -> Self {
Self::CliParsing(e.into())
}
}
impl From<FigmentError> for OrthoError {
fn from(e: FigmentError) -> Self {
Self::Gathering(e.into())
}
}
impl From<OrthoError> for FigmentError {
fn from(e: OrthoError) -> Self {
match e {
OrthoError::Merge { source: fe } | OrthoError::Gathering(fe) => *fe,
other => Self::from(other.to_string()),
}
}
}