1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use std::{ error::Error, fmt::{self, Display, Formatter}, }; #[derive(Debug)] pub enum WXFError { Custom(String), } impl Display for WXFError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } } impl Error for WXFError {} impl serde::ser::Error for WXFError { fn custom<T>(msg: T) -> Self where T: Display, { Self::Custom(msg.to_string()) } } pub type Result<T> = std::result::Result<T, WXFError>;