Skip to main content

apfs/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ApfsError {
5    #[error("I/O error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("invalid magic: 0x{0:08X}")]
9    InvalidMagic(u32),
10
11    #[error("invalid checksum")]
12    InvalidChecksum,
13
14    #[error("invalid B-tree: {0}")]
15    InvalidBTree(String),
16
17    #[error("file not found: {0}")]
18    FileNotFound(String),
19
20    #[error("not a directory: {0}")]
21    NotADirectory(String),
22
23    #[error("corrupted data: {0}")]
24    CorruptedData(String),
25
26    #[error("no volume found in container")]
27    NoVolume,
28}
29
30pub type Result<T> = std::result::Result<T, ApfsError>;