33 lines
664 B
Rust
33 lines
664 B
Rust
use std::{fmt, io};
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
IO(io::Error),
|
|
Figment(figment::Error),
|
|
}
|
|
|
|
impl fmt::Display for Error {
|
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
Error::IO(err) => write!(fmt, "{}", err),
|
|
Error::Figment(err) => write!(fmt, "{}", err),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
impl From<io::Error> for Error {
|
|
fn from(err: io::Error) -> Self {
|
|
Error::IO(err)
|
|
}
|
|
}
|
|
|
|
impl From<figment::Error> for Error {
|
|
fn from(err: figment::Error) -> Self {
|
|
Error::Figment(err)
|
|
}
|
|
}
|