1use crate::FourCC;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 #[error("out of bounds")]
6 OutOfBounds,
7
8 #[error("short read")]
9 ShortRead,
10
11 #[error("over decode: {0}")]
12 OverDecode(FourCC),
13
14 #[error("under decode: {0}")]
15 UnderDecode(FourCC),
16
17 #[error("atom too large")]
18 TooLarge(FourCC),
19
20 #[error("invalid size")]
21 InvalidSize,
22
23 #[error("invalid fourcc")]
24 InvalidFourCC,
25
26 #[error("unknown version: {0}")]
27 UnknownVersion(u8),
28
29 #[error("invalid string: {0}")]
30 InvalidString(String),
31
32 #[error("missing box: {0}")]
33 MissingBox(FourCC),
34
35 #[error("unexpected box: {0}")]
36 UnexpectedBox(FourCC),
37
38 #[error("duplicate box: {0}")]
39 DuplicateBox(FourCC),
40
41 #[error("missing descriptor: {0}")]
42 MissingDescriptor(u8),
43
44 #[error("unexpected descriptor: {0}")]
45 UnexpectedDescriptor(u8),
46
47 #[error("unexpected eof")]
48 UnexpectedEof,
49
50 #[error("out of memory")]
52 OutOfMemory,
53
54 #[error("reserved")]
55 Reserved,
56
57 #[error("io error: {0}")]
58 Io(#[from] std::io::Error),
59}
60
61pub type Result<T> = std::result::Result<T, Error>;