Skip to content

Commit

Permalink
Merge branch 'tiago/fix-tok-bal-query-errs' (#2356)
Browse files Browse the repository at this point in the history
* origin/tiago/fix-tok-bal-query-errs:
  Changelog
  Fix querying error while checking token balance
  • Loading branch information
brentstone committed Jan 12, 2024
2 parents 2be10f6 + 472a0cd commit 196b789
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Suppress querying errors when a user has no token balance
([\#1910](https://github.com/anoma/namada/issues/1910))
19 changes: 13 additions & 6 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ use namada::types::masp::{BalanceOwner, ExtendedViewingKey, PaymentAddress};
use namada::types::storage::{BlockHeight, BlockResults, Epoch, Key, KeySeg};
use namada::types::token::{Change, MaspDenom};
use namada::types::{storage, token};
use namada_sdk::error::{is_pinned_error, Error, PinnedBalanceError};
use namada_sdk::error::{
is_pinned_error, Error, PinnedBalanceError, QueryError,
};
use namada_sdk::masp::{Conversions, MaspAmount, MaspChange};
use namada_sdk::proof_of_stake::types::ValidatorMetaData;
use namada_sdk::rpc::{
Expand Down Expand Up @@ -338,15 +340,20 @@ pub async fn query_transparent_balance(
balance
);
}
Err(e) => {
display_line!(context.io(), "Querying error: {e}");
Err(namada_sdk::error::Error::Query(
QueryError::NoSuchKey(_),
)) => {
display_line!(
context.io(),
"No {} balance found for {}",
token_alias,
owner
"No {token_alias} balance found for {owner}",
)
}
Err(e) => {
display_line!(
context.io(),
"Error querying balance of {token_alias}: {e}"
);
}
}
}
}
Expand Down

0 comments on commit 196b789

Please sign in to comment.