rsomeip/bytes/
error.rs

1pub type Result<T> = std::result::Result<T, Error>;
2
3#[derive(Debug, PartialEq, Eq)]
4pub enum Error {
5    Message(String),
6    Failure,
7    BufferOverflow,
8    LengthOverflow,
9    ExceedsLimit,
10}
11
12impl std::fmt::Display for Error {
13    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14        match self {
15            Self::Message(msg) => write!(f, "{msg}"),
16            Self::Failure => write!(f, "operation failed unexpectedly"),
17            Self::BufferOverflow => write!(f, "writing exceeds buffer capacity"),
18            Self::LengthOverflow => write!(f, "length exceeds maximum value"),
19            Self::ExceedsLimit => write!(f, "operation exceeds limit"),
20        }
21    }
22}
23
24impl std::error::Error for Error {}