1use crate::image_tlv::ImageTlvAreaType;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5 #[error("I/O error")]
6 Io(#[from] std::io::Error),
7 #[error("unable to parse image: {0}")]
8 ImageParsing(std::io::Error),
9 #[error("invalid image header magic: 0x{0:08x}")]
10 InvalidHeaderMagic(u32),
11 #[error("image TLV entry type: 0x{0:04x} not found")]
12 TlvEntryTypeNotFound(u16),
13 #[error("invalid image TLV magic: 0x{0:04x}")]
14 InvalidTlvMagic(u16),
15 #[error("missing non-protected TLV area. Found instead: {0:?}")]
16 NonProtectedTlvAreaNotFound(ImageTlvAreaType),
17 #[error("invalid image TLV length")]
18 InvalidTlvLength,
19}