1use super::{boot_sector, directory_entry};
2
3#[non_exhaustive]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(thiserror::Error, Debug)]
6pub enum ExFatError<E> {
7 #[error("io")]
8 Io(E),
9
10 #[error("directory entry ({0:?})")]
11 DirectoryEntry(#[from] directory_entry::Error),
12
13 #[error("boot sector not valid exFAT ({0:?})")]
14 NotExFat(#[from] boot_sector::Error),
15
16 #[error("end of fat chain")]
17 EndOfFatChain,
18
19 #[error("invalid utf16 string encountered ({reason})")]
20 InvalidUtf16String { reason: &'static str },
21
22 #[error("invalid file name ({reason})")]
23 InvalidFileName { reason: &'static str },
24
25 #[error("invalid file system ({reason})")]
26 InvalidFileSystem { reason: &'static str },
27
28 #[error("file not found")]
29 FileNotFound,
30
31 #[error("directory not found")]
32 DirectoryNotFound,
33
34 #[error("invalid utf8 bytes")]
35 Utf8Error,
36
37 #[error("disk is full")]
38 DiskFull,
39
40 #[error("invalid cluster id ({0})")]
41 InvalidClusterId(u32),
42
43 #[error("invalid sector id ({0})")]
44 InvalidSectorId(u32),
45
46 #[error("directory is not empty")]
47 DirectoryNotEmpty,
48
49 #[error("write not enabled")]
50 WriteNotEnabled,
51
52 #[error("read not enabled")]
53 ReadNotEnabled,
54
55 #[error("file already exists")]
56 AlreadyExists,
57
58 #[error("cannot seek past the end of the valid data in the file")]
59 SeekOutOfRange,
60
61 #[error("attempt to change the allocation bitmap to a value with no effect")]
62 InvalidAllocation {
63 lba: u32,
64 index: usize,
65 allocated: bool,
66 allocated_new: bool,
67 },
68
69 #[error("the combination of flags set when opening the file is not valid")]
70 InvalidOptions,
71
72 #[error("unexpected error occured: {0}")]
73 Unexpected(&'static str),
74
75 #[error("supplied buffer to decode file name into was too small")]
76 FileNameBufferTooSmall,
77
78 #[error("growing a directory not yet supported")]
79 DirectoryFull,
80}