diff --git a/usdpl-back/src/api_common/files.rs b/usdpl-back/src/api_common/files.rs index cb7b890..08e4e14 100644 --- a/usdpl-back/src/api_common/files.rs +++ b/usdpl-back/src/api_common/files.rs @@ -13,6 +13,7 @@ pub fn write_single, D: Display>(path: P, display: D) -> Result<( } /// read_single error +#[derive(Debug)] pub enum ReadError { /// IO Error Io(io::Error), @@ -20,6 +21,19 @@ pub enum ReadError { Parse(E), } +impl std::fmt::Display for ReadError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Io(io) => write!(f, "io: {}", io), + Self::Parse(e) => write!(f, "parse: {}", e), + } + } +} + +impl std::error::Error for ReadError { + +} + /// Read something from a file. /// Useful for kernel configuration files. pub fn read_single, D: FromStr, E>(path: P) -> Result> {