From 7f0c818313131a7a7502fadf8ee51e6314f542af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Tue, 31 May 2022 23:16:55 +1200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20print=20"Fatal=20error"=20for?= =?UTF-8?q?=20UserAbort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/errors.rs | 3 ++- src/main.rs | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 16f7233d..cb3a2bd1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,6 +1,6 @@ use std::process::{ExitCode, Termination}; -use log::warn; +use log::{error, warn}; use miette::{Diagnostic, Report}; use thiserror::Error; @@ -189,6 +189,7 @@ impl Termination for BinstallError { if let BinstallError::UserAbort = self { warn!("Installation cancelled"); } else { + error!("Fatal error:"); eprintln!("{:?}", Report::new(self)); } diff --git a/src/main.rs b/src/main.rs index fa70206d..5af8b851 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,10 +93,7 @@ impl Termination for MainExit { info!("Installation completed in {spent:?}"); ExitCode::SUCCESS } - Self::Error(err) => { - error!("Fatal error:"); - err.report() - } + Self::Error(err) => err.report(), Self::Report(err) => { error!("Fatal error:"); eprintln!("{err:?}");