Avril 4 years ago
parent 44269293dc
commit 4634595261
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,17 +1,33 @@
//! Config parsing error //! Config parsing error
use super::*; use super::*;
use std::{
io,
};
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
IO(io::Error),
Unknown,
} }
impl std::error::Error for Error{} impl std::error::Error for Error
{
fn source(&self) -> Option<&(dyn std::error::Error + 'static)>
{
Some(match &self {
Self::IO(io) => io,
_ => return None,
})
}
}
impl std::fmt::Display for Error impl std::fmt::Display for Error
{ {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{ {
todo!() match self {
Self::IO(io) => write!(f, "i/o error: {}", io),
Self::Unknown => write!(f, "unknown error")
}
} }
} }

Loading…
Cancel
Save