attach more contexts

This commit is contained in:
Bryan Stitt 2023-04-14 03:43:49 -07:00
parent fffd645acf
commit 2652f88f52

@ -537,7 +537,8 @@ impl Web3Rpc {
// trace!("waiting on chain id for {}", self); // trace!("waiting on chain id for {}", self);
let found_chain_id: Result<U64, _> = self let found_chain_id: Result<U64, _> = self
.wait_for_request_handle(&authorization, None, unlocked_provider.clone()) .wait_for_request_handle(&authorization, None, unlocked_provider.clone())
.await? .await
.context(format!("waiting for request handle on {}", self))?
.request( .request(
"eth_chainId", "eth_chainId",
&json!(Option::None::<()>), &json!(Option::None::<()>),
@ -560,18 +561,20 @@ impl Web3Rpc {
} }
} }
Err(e) => { Err(e) => {
return Err(anyhow::Error::from(e)); return Err(anyhow::Error::from(e)
.context(format!("unable to parse eth_chainId from {}", self)));
} }
} }
self.check_block_data_limit(&authorization, unlocked_provider.clone()) self.check_block_data_limit(&authorization, unlocked_provider.clone())
.await?; .await
.context(format!("unable to parse eth_chainId from {}", self))?;
drop(unlocked_provider); drop(unlocked_provider);
info!("successfully connected to {}", self); info!("successfully connected to {}", self);
} else if self.provider.read().await.is_none() { } else if self.provider.read().await.is_none() {
return Err(anyhow!("failed waiting for client")); return Err(anyhow!("failed waiting for client {}", self));
}; };
Ok(()) Ok(())