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