commonware_codec/
error.rs

1//! Error types for codec operations
2
3use thiserror::Error;
4
5/// Error type for codec operations
6#[derive(Error, Debug)]
7pub enum Error {
8    #[error("Unexpected End-of-Buffer")]
9    EndOfBuffer,
10    #[error("Extra Data: {0} bytes")]
11    ExtraData(usize),
12    #[error("Length Exceeded: {0} > {1}")]
13    LengthExceeded(usize, usize), // found, max
14    #[error("Invalid Varint")]
15    InvalidVarint,
16    #[error("Invalid Bool")]
17    InvalidBool,
18    #[error("Invalid. Context({0}), Message({1})")]
19    Invalid(&'static str, &'static str),
20    #[error("Invalid. Context({0}), Error({1})")]
21    Wrapped(&'static str, Box<dyn std::error::Error + Send + Sync>),
22}