Refactor backup file removal logic to simplify error handling and improve clarity

This commit is contained in:
Greg Burri 2025-04-06 23:30:47 +02:00
parent 30f3b41cc7
commit 182c951fd2
2 changed files with 368 additions and 39 deletions

View file

@ -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) => {