1#[derive(Debug, Copy, Clone, PartialEq, Eq)]
5#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
6pub enum WireError {
7 ReadBufferTooShort,
9 WriteBufferTooShort,
11 InvalidValue,
16 ArrayLength,
18 InvalidUtf8,
20}
21
22#[cfg(feature = "std")]
23impl std::error::Error for WireError {}
24
25impl core::fmt::Display for WireError {
26 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
27 match self {
28 WireError::ReadBufferTooShort => {
29 write!(f, "Read buffer too short to extract type from")
30 }
31 WireError::WriteBufferTooShort => {
32 write!(f, "Write buffer too short to pack type into")
33 }
34 WireError::InvalidValue => f.write_str("Invalid decoded value"),
35 WireError::ArrayLength => f.write_str("Incorrect array length"),
36 WireError::InvalidUtf8 => f.write_str("Invalid UTF8"),
37 }
38 }
39}