Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix querying error while checking token balance #2356

Merged
merged 2 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading