Refactor backup file removal logic to simplify error handling and improve clarity
This commit is contained in:
parent
30f3b41cc7
commit
182c951fd2
2 changed files with 368 additions and 39 deletions
|
|
@ -66,21 +66,14 @@ where
|
|||
"Error when compressing backup file: {}",
|
||||
error
|
||||
);
|
||||
} else if let Err(error) = std::fs::remove_file(&path) {
|
||||
event!(
|
||||
Level::ERROR,
|
||||
"Error when removing uncompressed backup file: {}",
|
||||
error
|
||||
);
|
||||
} else {
|
||||
match std::fs::remove_file(&path) {
|
||||
Ok(()) => event!(
|
||||
Level::INFO,
|
||||
"Backup done: {}",
|
||||
path_compressed.display()
|
||||
),
|
||||
Err(error) => {
|
||||
event!(
|
||||
Level::ERROR,
|
||||
"Error when removing uncompressed backup file: {}",
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
event!(Level::INFO, "Backup done: {}", path_compressed.display());
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue