Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
IPC-373: return errors at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
adlrocha committed Nov 6, 2023
1 parent de0ea1f commit 1ea406e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ipc/cli/src/commands/wallet/balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ impl CommandLineHandler for WalletBalances {

let wallet_type = WalletType::from_str(&arguments.wallet_type)?;
let subnet = SubnetID::from_str(&arguments.subnet)?;
let mut errors = Vec::new();

match wallet_type {
WalletType::Evm => {
let wallet = provider.evm_wallet()?;
Expand Down Expand Up @@ -58,10 +60,19 @@ impl CommandLineHandler for WalletBalances {
}
}
Err(e) => {
return Err(e);
errors.push(e);
}
}
}

if !errors.is_empty() {
let error = errors
.into_iter()
.fold(anyhow::anyhow!("Error fetching balances"), |acc, err| {
acc.context(err)
});
return Err(error);
}
}
WalletType::Fvm => {
let wallet = provider.fvm_wallet()?;
Expand Down

0 comments on commit 1ea406e

Please sign in to comment.