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

Clarify errors in main() coming from the governance canister client. #232

Merged
merged 1 commit into from
Mar 6, 2024
Merged
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
18 changes: 14 additions & 4 deletions rs/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ async fn main() -> Result<(), anyhow::Error> {
let mut cli_opts = cli::Opts::parse();
let mut cmd = cli::Opts::command();

let governance_canister_v = governance_canister_version(cli_opts.network.get_url()).await?;
let governance_canister_v = match governance_canister_version(cli_opts.network.get_url()).await {
Ok(c) => c,
Err(e) => {
return Err(anyhow::anyhow!(
"While determining the governance canister version: {}",
e
))
}
};

let governance_canister_version = governance_canister_v.stringified_hash;

let target_network = cli_opts.network.clone();
Expand All @@ -52,9 +61,10 @@ async fn main() -> Result<(), anyhow::Error> {
.expect("failed")
});
});

let srv = rx.recv().unwrap();

ic_admin::with_ic_admin(governance_canister_version.into(), async {
let r = ic_admin::with_ic_admin(governance_canister_version.into(), async {

// Start of actually doing stuff with commands.
if cli_opts.network == Network::Staging {
Expand Down Expand Up @@ -299,11 +309,11 @@ async fn main() -> Result<(), anyhow::Error> {
}
}
})
.await?;
.await;

srv.stop(false).await;

Ok(())
r
}

// Construct MinNakamotoCoefficients from an array (slice) of ["key=value"], and
Expand Down
Loading