mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-17 01:10:02 +00:00
Pretty-print errors
This commit is contained in:
parent
02c8c0af00
commit
84ebc0039e
2 changed files with 17 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::process::{ExitCode, Termination};
|
||||
|
||||
use log::warn;
|
||||
use miette::Diagnostic;
|
||||
use miette::{Report, Diagnostic};
|
||||
use thiserror::Error;
|
||||
|
||||
/// Errors emitted by the library portion of cargo-binstall.
|
||||
|
@ -182,12 +182,13 @@ impl BinstallError {
|
|||
|
||||
impl Termination for BinstallError {
|
||||
fn report(self) -> ExitCode {
|
||||
let code = self.exit_code();
|
||||
if let BinstallError::UserAbort = self {
|
||||
warn!("Installation cancelled");
|
||||
} else {
|
||||
eprintln!("{self:?}");
|
||||
eprintln!("{:?}", Report::new(self));
|
||||
}
|
||||
|
||||
self.exit_code()
|
||||
code
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue