From 02baf4b1f0bb3aa9f63e601f1c7c473d2e6b3eaf Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 26 Sep 2020 22:48:47 +0200 Subject: [PATCH] Show some inner errors (do not hide them with .context) (#1916) --- deltachat-ffi/src/lib.rs | 6 ++++-- src/configure/mod.rs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 213cb8b4e..38fcc4fdc 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -3242,7 +3242,8 @@ impl ResultExt for Result { fn log_err(self, ctx: &Context, message: &str) -> Result { self.map_err(|err| { - warn!(ctx, "{}: {}", message, err); + // We are using Anyhow's .context() and to show the inner error, too, we need the {:#}: + warn!(ctx, "{}: {:#}", message, err); err }) } @@ -3364,7 +3365,8 @@ pub unsafe extern "C" fn dc_accounts_new( match accs { Ok(accs) => Box::into_raw(Box::new(accs)), Err(err) => { - eprintln!("failed to create accounts: {}", err); + // We are using Anyhow's .context() and to show the inner error, too, we need the {:#}: + eprintln!("failed to create accounts: {:#}", err); ptr::null_mut() } } diff --git a/src/configure/mod.rs b/src/configure/mod.rs index 987019b0c..2187d2f12 100644 --- a/src/configure/mod.rs +++ b/src/configure/mod.rs @@ -125,7 +125,8 @@ impl Context { Some( self.stock_string_repl_str( StockMessage::ConfigurationFailed, - err.to_string(), + // We are using Anyhow's .context() and to show the inner error, too, we need the {:#}: + format!("{:#}", err), ) .await )