Skip to content

Commit

Permalink
feat: Provide a relevant faucet error message when helper API server …
Browse files Browse the repository at this point in the history
…returns an error (#243)
  • Loading branch information
Yasir Shariff authored Oct 6, 2023
1 parent 70b2f0f commit ac0e629
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ impl NewAccountContext {
let client = reqwest::blocking::Client::new();
match client.post(faucet_service_url.clone()).json(&data).send() {
Ok(response) => {
if response.status() >= reqwest::StatusCode::BAD_REQUEST {
return Err(color_eyre::Report::msg(format!(
"The faucet (helper service) server failed with status code <{}>",
response.status()
)));
}

let account_creation_transaction = response
.json::<near_jsonrpc_client::methods::tx::RpcTransactionStatusResponse>(
)?;
Expand Down

0 comments on commit ac0e629

Please sign in to comment.