use std::io;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum FatError {
#[error("I/O error during {op}: {source}")]
Io {
op: &'static str,
source: io::Error,
},
#[error("invalid boot sector: {0}")]
InvalidBoot(String),
#[error("not a FAT/exFAT volume: {0}")]
NotFat(String),
#[error("corrupt structure: {0}")]
Corrupt(String),
}
impl FatError {
#[must_use]
pub fn io(op: &'static str, source: io::Error) -> Self {
FatError::Io { op, source }
}
}
pub type Result<T> = std::result::Result<T, FatError>;