stak_file/file_system/
error.rs1use core::{
2 error,
3 fmt::{self, Display, Formatter},
4};
5
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub enum FileError {
9 Open,
11 Close,
13 InvalidFileDescriptor,
15 Read,
17 Write,
19 Delete,
21 Exists,
23 PathDecode,
25}
26
27impl error::Error for FileError {}
28
29impl Display for FileError {
30 fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
31 match self {
32 Self::Open => write!(formatter, "cannot open file"),
33 Self::Close => write!(formatter, "cannot close file"),
34 Self::InvalidFileDescriptor => write!(formatter, "invalid file descriptor"),
35 Self::Read => write!(formatter, "cannot read file"),
36 Self::Write => write!(formatter, "cannot write file"),
37 Self::Delete => write!(formatter, "cannot delete file"),
38 Self::Exists => write!(formatter, "cannot check file existence"),
39 Self::PathDecode => write!(formatter, "cannot decode path"),
40 }
41 }
42}