pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("buffer too short: need {need}, have {have} ({what})")]
BufferTooShort {
need: usize,
have: usize,
what: &'static str,
},
#[error("output buffer too small: need {need}, have {have}")]
OutputBufferTooSmall {
need: usize,
have: usize,
},
#[error("invalid SNDU length {length}: {reason}")]
InvalidLength {
length: u16,
reason: &'static str,
},
#[error("SNDU CRC mismatch: computed {computed:#010X}, found {found:#010X}")]
CrcMismatch {
computed: u32,
found: u32,
},
#[error("field {what} value {value} does not fit in {bits} bits")]
FieldTooWide {
what: &'static str,
value: u32,
bits: u32,
},
#[error("invalid extension header: {reason}")]
InvalidExtensionHeader {
reason: &'static str,
},
#[error("TS mapping error: {reason}")]
TsMapping {
reason: &'static str,
},
}