#[derive(Debug, thiserror::Error)]
pub enum AbxError {
#[error("invalid magic header: expected {expected:?}, got {actual:?}")]
InvalidMagic {
expected: [u8; 4],
actual: [u8; 4],
},
#[error("unexpected end of input while reading {0}")]
UnexpectedEof(&'static str),
#[error("invalid interned string index {0}")]
BadInternedIndex(u16),
#[error("invalid UTF-8 in string")]
InvalidUtf8,
#[error("unknown attribute type 0x{0:02X}")]
UnknownAttributeType(u8),
#[error("unknown command 0x{0:02X}")]
UnknownCommand(u8),
#[error("value too long: {len} bytes exceeds maximum of {max}")]
ValueTooLong {
len: usize,
max: usize,
},
#[error("nom parse error: {0}")]
Nom(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("deserialization error: {0}")]
Deserialization(String),
#[error("XML parse error: {0}")]
Xml(String),
}
pub type Result<T> = std::result::Result<T, AbxError>;