From da140d4f2f390ccac1cc2bb5bb2e267cd338c88c Mon Sep 17 00:00:00 2001 From: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:41:08 -0500 Subject: [PATCH] handle submit errors --- src/analytics/enrich_account_funding.rs | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/analytics/enrich_account_funding.rs b/src/analytics/enrich_account_funding.rs index d75522c..702a6b8 100644 --- a/src/analytics/enrich_account_funding.rs +++ b/src/analytics/enrich_account_funding.rs @@ -196,13 +196,25 @@ impl BalanceTracker { let data = self.to_cypher_map(*id)?; let query_literal = generate_cypher_query(data); let query = Query::new(query_literal); - let mut result = pool.execute(query).await?; - - while let Some(r) = result.next().await? { - if let Ok(i) = r.get::("merged_relations") { - trace!("merged ledger in tx: {i}"); - merged_relations += i; - }; + let result = pool.execute(query).await; + + match result { + Ok(mut d) => { + while let r = d.next().await.ok() { + match r { + Ok(row) => { + if let Some(r) = row { + if let Ok(i) = r.get::("merged_relations") { + trace!("merged ledger in tx: {i}"); + merged_relations += i; + }; + } + } + Err(e) => error!("could not parse row in cypher query response: {}", e), + } + } + } + Err(e) => error!("could not get response in cypher query response: {}", e), } } Ok(merged_relations)