diff --git a/src/lib.rs b/src/lib.rs index b8065083d..836ed8e2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,12 +19,15 @@ pub fn cli_print_error_chain<'a>( &'a (dyn Error + 'static), ) -> Option, ) { - let msg = format!("Error: {component} exited with the following"); + // Debug info. + error!("Fatal error: {top_error:?}"); + + eprint!("Error: {component} exited with the following "); if top_error.source().is_none() { - error!("{msg} error:"); - error!(" {top_error}"); + eprintln!("error:"); + eprintln!(" {top_error}"); } else { - error!("{msg} chain of errors:"); + eprintln!("chain of errors:"); std::iter::successors(Some(top_error), |sub_error| { // Dereference necessary to mitigate rustc compiler bug. // See @@ -34,13 +37,10 @@ pub fn cli_print_error_chain<'a>( .for_each(|(level, error)| { // Special case: handling of HTTP Server responses in ch-remote if let Some(message) = display_modifier(level, 2, error) { - error!("{message}"); + eprintln!("{message}"); } else { - error!(" {level}: {error}"); + eprintln!(" {level}: {error}"); } }); } - - error!(""); - error!("Debug Info: {top_error:?}"); }