Skip to main content

hfsplus/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum HfsPlusError {
5    #[error("I/O error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("invalid HFS+ signature: 0x{0:04X} (expected 0x482B or 0x4858)")]
9    InvalidSignature(u16),
10
11    #[error("invalid B-tree: {0}")]
12    InvalidBTree(String),
13
14    #[error("file not found: {0}")]
15    FileNotFound(String),
16
17    #[error("not a directory: {0}")]
18    NotADirectory(String),
19
20    #[error("corrupted data: {0}")]
21    CorruptedData(String),
22
23    #[error("unsupported version: {0}")]
24    UnsupportedVersion(u16),
25}
26
27pub type Result<T> = std::result::Result<T, HfsPlusError>;