1use core::fmt;
2
3#[derive(Debug)]
4#[non_exhaustive]
5pub enum Error {
7 UnexpectedType,
9 InsufficientData,
11 InvalidData,
13 UnknownField(String),
15}
16
17impl fmt::Display for Error {
18 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19 match self {
20 Error::UnexpectedType => write!(f, "Unexpected MessagePack type"),
21 Error::InsufficientData => write!(f, "Insufficient data to decode"),
22 Error::InvalidData => write!(f, "Invalid MessagePack data"),
23 Error::UnknownField(field) => write!(f, "Unknown field: {}", field),
24 }
25 }
26}
27
28impl std::error::Error for Error {}