Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error for dirty file system. #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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