1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, Error)]
10pub enum Error {
11 #[error("I/O error: {0}")]
13 Io(#[from] std::io::Error),
14
15 #[error("lwext4 error: {0}")]
17 Lwext4(i32),
18
19 #[error("Invalid configuration: {0}")]
21 InvalidConfig(String),
22
23 #[error("Block device too small: minimum {min} bytes, got {actual} bytes")]
25 DeviceTooSmall { min: u64, actual: u64 },
26}
27
28impl Error {
29 pub fn from_lwext4(code: i32) -> Self {
31 Error::Lwext4(code)
32 }
33}