1use displaydoc::Display;
2use thiserror::Error;
3
4#[derive(Debug, Display)]
5pub enum DataError {
6 NotExFAT,
8 BootChecksum,
10 AllocationBitmapMissing,
12 UpcaseTableMissing,
14 UpcaseTableChecksum,
16 FATChain,
18 Metadata,
20}
21
22impl core::error::Error for DataError {}
23
24#[derive(Debug, Display)]
25pub enum ImplementationError {
26 TexFATNotSupported,
28 CreateDirectoryNotSupported,
30}
31
32impl core::error::Error for ImplementationError {}
33
34#[derive(Debug, Display)]
35pub enum InputError {
36 NameTooLong,
38 SeekPosition,
40 Size,
42}
43
44impl core::error::Error for InputError {}
45
46#[derive(Debug, Display)]
47pub enum AllocationError {
48 NotPossible,
50 Fragment,
52 NoMoreCluster,
54}
55
56impl core::error::Error for AllocationError {}
57
58#[derive(Debug, Display)]
59pub enum OperationError {
60 AlreadyOpen,
62 NotFound,
64 NotFile,
66 NotDirectory,
68 AlreadyExists,
70 DirectoryNotEmpty,
72 EOF,
74}
75
76impl core::error::Error for OperationError {}
77
78#[derive(Error, Debug)]
79pub enum Error<E> {
80 #[error("IO({0:?})")]
81 IO(E),
82 #[error("{0:?}")]
83 Data(#[from] DataError),
84 #[error("{0:?}")]
85 Implementation(#[from] ImplementationError),
86 #[error("{0:?}")]
87 Input(#[from] InputError),
88 #[error("{0:?}")]
89 Operation(#[from] OperationError),
90 #[error("{0:?}")]
91 Allocation(#[from] AllocationError),
92}