mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
improve fatal error message
This commit is contained in:
parent
2da497c1ca
commit
70bdfc4e99
@ -182,13 +182,19 @@ pub fn run(
|
||||
// about whether the command succeeded without such a message
|
||||
info!(accessible, "Successfully compressed '{}'.", to_utf(&output_path));
|
||||
} else {
|
||||
// If Ok(false) or Err() occurred, delete incomplete file at `output_path`
|
||||
//
|
||||
// if deleting fails, print an extra alert message pointing
|
||||
// out that we left a possibly CORRUPTED file at `output_path`
|
||||
if let Err(_) = utils::remove_file_or_dir(&output_path) {
|
||||
eprintln!("{red}FATAL ERROR:\n", red = *colors::RED);
|
||||
eprintln!(" Please manually delete '{}'.", to_utf(&output_path));
|
||||
eprintln!(
|
||||
" Compression failed and we could not delete '{}'.",
|
||||
to_utf(&output_path),
|
||||
);
|
||||
eprintln!(" Ouch failed to delete the file '{}'.", to_utf(&output_path));
|
||||
eprintln!(" Please delete it manually.");
|
||||
eprintln!(" This file is corrupted if compression didn't finished.");
|
||||
|
||||
if let Err(_) = compress_result {
|
||||
eprintln!(" Compression failed for reasons below.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user