From 89009dcd427dae50c93a1ed13d373499eb8cb4c8 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sun, 18 Jun 2023 16:40:17 -0700 Subject: [PATCH] use web3_context for more errors --- web3_proxy/src/frontend/admin.rs | 3 ++- web3_proxy/src/frontend/authorization.rs | 3 ++- web3_proxy/src/frontend/users/payment.rs | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web3_proxy/src/frontend/admin.rs b/web3_proxy/src/frontend/admin.rs index d64241e1..e2276d0d 100644 --- a/web3_proxy/src/frontend/admin.rs +++ b/web3_proxy/src/frontend/admin.rs @@ -134,7 +134,8 @@ pub async fn admin_increase_balance( .to_owned(), ) .exec(&db_conn) - .await?; + .await + .web3_context("admin is increasing balance")?; let response = (StatusCode::OK, Json(out)).into_response(); diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index 85e49404..e0fa5023 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -1227,7 +1227,8 @@ impl Web3ProxyApp { .to_owned(), ) .exec(&db_conn) - .await?; + .await + .web3_context("creating empty balance row for existing user")?; continue; } diff --git a/web3_proxy/src/frontend/users/payment.rs b/web3_proxy/src/frontend/users/payment.rs index 255baf26..37b14bff 100644 --- a/web3_proxy/src/frontend/users/payment.rs +++ b/web3_proxy/src/frontend/users/payment.rs @@ -1,5 +1,5 @@ use crate::app::Web3ProxyApp; -use crate::errors::{Web3ProxyError, Web3ProxyResponse, Web3ProxyResult}; +use crate::errors::{Web3ProxyError, Web3ProxyErrorContext, Web3ProxyResponse, Web3ProxyResult}; use crate::frontend::authorization::{ login_is_authorized, Authorization as Web3ProxyAuthorization, }; @@ -313,7 +313,8 @@ pub async fn user_balance_post( .to_owned(), ) .exec(&txn) - .await?; + .await + .web3_context("increasing balance")?; trace!("Saving log {} of txid {:?}", log_index, tx_hash); let receipt = increase_on_chain_balance_receipt::ActiveModel {