Skip to main content

uni_btic/
error.rs

1use thiserror::Error;
2
3/// Errors produced by BTIC construction, encoding, decoding, and parsing.
4#[derive(Debug, Error, Clone, PartialEq, Eq)]
5pub enum BticError {
6    #[error("INV-1: lo ({lo}) must be less than hi ({hi})")]
7    BoundOrdering { lo: i64, hi: i64 },
8
9    #[error("INV-4: non-zero reserved/version/flags bits in meta word")]
10    ReservedBits,
11
12    #[error("INV-5: granularity code {0:#x} out of valid range 0x0..=0xA")]
13    GranularityRange(u8),
14
15    #[error("INV-6: sentinel bound must have zeroed granularity and certainty")]
16    SentinelMetadata,
17
18    #[error("invalid BTIC literal: {0}")]
19    ParseError(String),
20
21    #[error("BTIC buffer must be exactly 24 bytes, got {0}")]
22    InvalidLength(usize),
23}