use std::{error::Error, fmt, fmt::Display}; #[derive(Debug, PartialEq)] pub struct KappeError { pub message: String, } impl KappeError { pub fn new(message: &str) -> Self { Self { message: message.to_string(), } } } impl Display for KappeError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", &self.message) } } impl Error for KappeError {} impl From for std::io::Error { fn from(e: KappeError) -> Self { Self::new(std::io::ErrorKind::InvalidInput, e.message) } }