From 7a1270f86181d93d9d204a828147286e33fa3012 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 17 Feb 2024 03:41:34 +0000 Subject: [PATCH] refactor: return error with a cause when failing to export keys --- src/imex.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/imex.rs b/src/imex.rs index 92c0061f54..0c8b4e525f 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -389,11 +389,11 @@ async fn imex_inner( if what == ImexMode::ExportBackup || what == ImexMode::ExportSelfKeys { // before we export anything, make sure the private key exists - if e2ee::ensure_secret_key_exists(context).await.is_err() { - bail!("Cannot create private key or private key not available."); - } else { - create_folder(context, &path).await?; - } + e2ee::ensure_secret_key_exists(context) + .await + .context("Cannot create private key or private key not available")?; + + create_folder(context, &path).await?; } match what {