use displaydoc::Display;
use thiserror::Error;
#[derive(Debug, Display)]
pub enum DataError {
NotExFAT,
BootChecksum,
AllocationBitmapMissing,
UpcaseTableMissing,
UpcaseTableChecksum,
FATChain,
Metadata,
}
impl core::error::Error for DataError {}
#[derive(Debug, Display)]
pub enum ImplementationError {
TexFATNotSupported,
CreateDirectoryNotSupported,
}
impl core::error::Error for ImplementationError {}
#[derive(Debug, Display)]
pub enum InputError {
NameTooLong,
SeekPosition,
Size,
}
impl core::error::Error for InputError {}
#[derive(Debug, Display)]
pub enum AllocationError {
NotPossible,
Fragment,
NoMoreCluster,
}
impl core::error::Error for AllocationError {}
#[derive(Debug, Display)]
pub enum OperationError {
AlreadyOpen,
NotFound,
NotFile,
NotDirectory,
AlreadyExists,
DirectoryNotEmpty,
EOF,
}
impl core::error::Error for OperationError {}
#[derive(Error, Debug)]
pub enum Error<E> {
#[error("IO({0:?})")]
IO(E),
#[error("{0:?}")]
Data(#[from] DataError),
#[error("{0:?}")]
Implementation(#[from] ImplementationError),
#[error("{0:?}")]
Input(#[from] InputError),
#[error("{0:?}")]
Operation(#[from] OperationError),
#[error("{0:?}")]
Allocation(#[from] AllocationError),
}