refactor: return error with a cause when failing to export keys

This commit is contained in:
link2xt
2024-02-17 03:41:34 +00:00
parent b35b893351
commit 7a1270f861

View File

@@ -389,11 +389,11 @@ async fn imex_inner(
if what == ImexMode::ExportBackup || what == ImexMode::ExportSelfKeys { if what == ImexMode::ExportBackup || what == ImexMode::ExportSelfKeys {
// before we export anything, make sure the private key exists // before we export anything, make sure the private key exists
if e2ee::ensure_secret_key_exists(context).await.is_err() { e2ee::ensure_secret_key_exists(context)
bail!("Cannot create private key or private key not available."); .await
} else { .context("Cannot create private key or private key not available")?;
create_folder(context, &path).await?;
} create_folder(context, &path).await?;
} }
match what { match what {