1use crate::base::VInt64;
2
3#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7 #[error("I/O error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("Invalid variable-length integer encoding, 8 leading zeros found...")]
13 InvalidVInt,
14
15 #[error("Attempted to read past the end of the buffer")]
17 OutOfBounds,
18
19 #[error("Element body over decode, ID: {0}")]
21 OverDecode(VInt64),
22
23 #[error("Short read: not all bytes were consumed")]
25 ShortRead,
26
27 #[error("Element body under decode, ID: {0}")]
29 UnderDecode(VInt64),
30
31 #[error("Missing element, ID: {0}")]
33 MissingElement(VInt64),
34
35 #[error("Duplicate element {id} in master element {parent}")]
37 DuplicateElement {
38 id: VInt64,
40 parent: VInt64,
42 },
43
44 #[error("Element body size is unknown, ID: {0}")]
46 ElementBodySizeUnknown(VInt64),
47
48 #[error("Malformed lacing data")]
50 MalformedLacingData,
51}
52
53pub type Result<T> = std::result::Result<T, Error>;