From 5c24a4629880a26234435d7c77666d59f4fc6f08 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 4 Mar 2021 17:16:18 +1100 Subject: [PATCH] Improve error message if stuff fails directly in main --- swap/src/bin/swap_cli.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swap/src/bin/swap_cli.rs b/swap/src/bin/swap_cli.rs index e02f69a3..cf7da039 100644 --- a/swap/src/bin/swap_cli.rs +++ b/swap/src/bin/swap_cli.rs @@ -72,10 +72,10 @@ async fn main() -> Result<()> { }; let db = Database::open(config.data.dir.join("database").as_path()) - .context("Could not open database")?; + .context("Failed to open database")?; let seed = - Seed::from_file_or_generate(&config.data.dir).expect("Could not retrieve/initialize seed"); + Seed::from_file_or_generate(&config.data.dir).context("Failed to read in seed file")?; // hardcode to testnet/stagenet let bitcoin_network = bitcoin::Network::Testnet; @@ -254,7 +254,8 @@ async fn init_bitcoin_wallet( &wallet_dir, seed.derive_extended_private_key(network)?, ) - .await?; + .await + .context("Failed to initialize Bitcoin wallet")?; wallet.sync().await?;