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 found: {0} bytes")]
11 ExtraData(usize),
12 #[error("invalid data in {0}: {1}")]
13 InvalidData(String, String), // context, message
14 #[error("length exceeded: {0} > {1}")]
15 LengthExceeded(usize, usize), // found, max
16 #[error("invalid varint")]
17 InvalidVarint,
18 #[error("invalid bool")]
19 InvalidBool,
20}