Skip to main content

cc_data/
error.rs

1//! Error type for cc_data parsing.
2
3/// Result alias.
4pub type Result<T> = core::result::Result<T, Error>;
5
6/// A cc_data parse error.
7#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
8#[non_exhaustive]
9pub enum Error {
10    /// Input shorter than required.
11    #[error(transparent)]
12    BufferTooShort(#[from] broadcast_common::error::BufferTooShort),
13    /// Output buffer too small for serialization.
14    #[error(transparent)]
15    OutputBufferTooSmall(#[from] broadcast_common::error::OutputBufferTooSmall),
16    /// More than 31 triplets — cc_count is a 5-bit field.
17    #[error("too many cc triplets: {0} (cc_count is 5-bit, max 31)")]
18    TooManyTriplets(usize),
19    /// A bit Table B.9 fixes to a constant value didn't have that value.
20    #[error(transparent)]
21    ReservedBits(#[from] broadcast_common::error::ReservedBits),
22}