diff --git a/src/config/error.rs b/src/config/error.rs index 8132abf..77ce4e7 100644 --- a/src/config/error.rs +++ b/src/config/error.rs @@ -1,17 +1,33 @@ //! Config parsing error - use super::*; +use std::{ + io, +}; #[derive(Debug)] 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 { 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") + } } }