Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub enum Error<T> {
DirectoryIsNotEmpty,
/// File system internal structures are corrupted/invalid.
CorruptedFileSystem,
/// File system is marked dirty.
DirtyFileSystem,
/// There is not enough free space on the storage to finish the requested operation.
NotEnoughSpace,
/// The provided file name is either too long or empty.
Expand Down Expand Up @@ -47,7 +49,7 @@ impl From<Error<std::io::Error>> for std::io::Error {
| Error::DirectoryIsNotEmpty => Self::new(std::io::ErrorKind::InvalidInput, error),
Error::NotFound => Self::new(std::io::ErrorKind::NotFound, error),
Error::AlreadyExists => Self::new(std::io::ErrorKind::AlreadyExists, error),
Error::CorruptedFileSystem => Self::new(std::io::ErrorKind::InvalidData, error),
Error::CorruptedFileSystem | Error::DirtyFileSystem => Self::new(std::io::ErrorKind::InvalidData, error),
}
}
}
Expand All @@ -66,6 +68,7 @@ impl<T: core::fmt::Display> core::fmt::Display for Error<T> {
Error::NotFound => write!(f, "No such file or directory"),
Error::AlreadyExists => write!(f, "File or directory already exists"),
Error::CorruptedFileSystem => write!(f, "Corrupted file system"),
Error::DirtyFileSystem => write!(f, "Dirty file system"),
}
}
}
Expand Down