Skip to main content

lxmf_core/
error.rs

1use alloc::string::String;
2use core::fmt;
3
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum LxmfError {
6    Decode(String),
7    Encode(String),
8    Io(String),
9    Verify(String),
10}
11
12impl fmt::Display for LxmfError {
13    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14        match self {
15            Self::Decode(err) => write!(f, "decode error: {err}"),
16            Self::Encode(err) => write!(f, "encode error: {err}"),
17            Self::Io(err) => write!(f, "io error: {err}"),
18            Self::Verify(err) => write!(f, "verify error: {err}"),
19        }
20    }
21}
22
23#[cfg(feature = "std")]
24impl std::error::Error for LxmfError {}