-
Notifications
You must be signed in to change notification settings - Fork 15
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
refactor(error): improve error messages and file handling #334
base: main
Are you sure you want to change the base?
Conversation
I kept: for i in 0u8..=255 {
let filename = self.path.join("data").join(hex::encode([i]));
fs::create_dir_all(&filename).map_err(|err| {
LocalBackendErrorKind::DirectoryCreationFailed {
path: filename.clone(),
source: err,
}
})?;
} as that impacts compatibility with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
I have just found a small thing I would change in this PR...
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
- Update error messages for file operations in the `LocalBackendErrorKind` enum. - Refactor the `ReadBackend` and `WriteBackend` implementations in the `LocalBackend` module to handle file opening errors more accurately. - Add error variants `OpeningFileForPartialReadingFailed` and `OpeningFileForWritingFailed` to provide specific information about file opening failures. - Create parent directory if it does not exist before opening the file for writing. Fixes #rustic-rs/rustic#1315 Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
c186960
to
0583d0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Looks good to me!
Just one question about an error
log.
let data = match be.read_full(FileType::Pack, &id) { | ||
Ok(data) => data, | ||
Err(err) => { | ||
error!("Error reading data for pack {id} : {err}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: should this error log be different from the one line 318?
Fixes rustic-rs/rustic#1315
Fixes #310