Skip to main content

omp_core/encoding/
error.rs

1/// Errors that can occur during base-N encoding/decoding operations.
2#[derive(Debug, thiserror::Error, PartialEq, Eq, PartialOrd, Ord)]
3pub enum DecodeError {
4	/// An invalid character was encountered during decoding.
5	#[error("invalid character: 0x{0:02x}")]
6	InvalidCharacter(u8),
7	/// The input length is invalid for the expected padded format.
8	#[error("invalid length for padded base-n input")]
9	InvalidLength,
10	/// The buffer is too small.
11	#[error("buffer too small: {0} bytes")]
12	BufferTooSmall(usize),
13	/// The input is too short for the expected length.
14	#[error("input length too short for expected length")]
15	InputTooShort,
16}
17
18/// Result type for base-N operations.
19pub type Result<T, E = DecodeError> = std::result::Result<T, E>;