1#[derive(Debug, thiserror::Error)]
3pub enum Error {
4 #[error("Two or more partitions with the same name ('{0}') were found")]
6 DuplicatePartitions(String),
7
8 #[error("The binary's checksum is invalid (expected '{expected:?}', computed '{computed:?}')")]
10 InvalidChecksum {
11 expected: Vec<u8>,
12 computed: Vec<u8>,
13 },
14
15 #[error("Partition with type 'data' and subtype 'ota' must have size of 0x2000 (8k) bytes")]
18 InvalidOtadataPartitionSize,
19
20 #[error("The length of the binary data is not a multiple of 32")]
22 LengthNotMultipleOf32,
23
24 #[error("Multiple partitions with type 'app' and subtype 'factory' were found")]
26 MultipleFactoryPartitions,
27
28 #[error("Multiple partitions with type 'data' and subtype 'ota' were found")]
30 MultipleOtadataPartitions,
31
32 #[error("No partition of type 'app' was found in the partition table")]
34 NoAppPartition,
35
36 #[error("No ned marker was found in the binary data")]
38 NoEndMarker,
39
40 #[error("Two partitions are overlapping each other: '{0}' and '{1}'")]
42 OverlappingPartitions(String, String),
43
44 #[error("Partition larger than maximum supported size of 16MB: '{0}'")]
46 PartitionTooLarge(String),
47
48 #[error("The partition is not correctly aligned")]
50 UnalignedPartition,
51
52 #[error(transparent)]
54 CsvError(#[from] csv::Error),
55
56 #[error(transparent)]
58 DekuError(#[from] deku::DekuError),
59
60 #[error(transparent)]
62 FromUtf8Error(#[from] std::string::FromUtf8Error),
63
64 #[error(transparent)]
66 IoError(#[from] std::io::Error),
67}