From 03025837d130e28e435873c07cab209a7f81df91 Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Mon, 18 Aug 2025 10:04:50 +1000 Subject: [PATCH] chore: add some error logs --- rust/src/ark/mod.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/rust/src/ark/mod.rs b/rust/src/ark/mod.rs index d3d1235..eb5c35d 100644 --- a/rust/src/ark/mod.rs +++ b/rust/src/ark/mod.rs @@ -91,10 +91,13 @@ pub async fn setup_client( let esplora = EsploraClient::new(esplora.as_str())?; tracing::info!("Checking esplora connection"); - esplora.check_connection().await?; + if let Err(err) = esplora.check_connection().await { + tracing::error!("Failed connecting to esplora {:?}", err); + } tracing::info!("Connecting to Ark"); - let client = OfflineClient::new( + + match OfflineClient::new( "alice".to_string(), kp, Arc::new(esplora), @@ -103,15 +106,18 @@ pub async fn setup_client( ) .connect() .await - .map_err(|err| anyhow!(err))?; - - let info = client.server_info.clone(); - - ARK_CLIENT.set(RwLock::new(Arc::new(client))); - - tracing::info!(server_pk = ?info.pk, "Connected to server"); + { + Err(err) => { + tracing::error!("Failed connecting to ark client {:?}", err); + bail!(err); + } + Ok(client) => { + let info = client.server_info.clone(); - Ok(info.pk.to_string()) + ARK_CLIENT.set(RwLock::new(Arc::new(client))); + Ok(info.pk.to_string()) + } + } } pub(crate) async fn wallet_exists(data_dir: String) -> Result {