handle empty result

This commit is contained in:
Bryan Stitt 2023-01-25 00:19:35 -08:00
parent 0c058614ce
commit 7e5418a8e7
2 changed files with 15 additions and 4 deletions

@ -184,11 +184,15 @@ async fn check_rpc(
Ok(abbreviated) Ok(abbreviated)
} else if let Some(result) = response.error { } else if let Some(result) = response.error {
Err(anyhow!( Err(anyhow!(
"Failed parsing response from {} as JSON: {:?}", "jsonrpc error during check_rpc from {}: {:#}",
rpc, rpc,
result json!(result),
)) ))
} else { } else {
unimplemented!("{:?}", response) Err(anyhow!(
"empty result during check_rpc from {}: {:#}",
rpc,
json!(response)
))
} }
} }

@ -152,7 +152,14 @@ impl SentrydSubCommand {
} }
// check any other web3-proxy /health endpoints // check any other web3-proxy /health endpoints
for other_web3_proxy in other_proxy.iter() { for other_web3_proxy in other_proxy.iter() {
let url = format!("{}/health", other_web3_proxy); let url = if other_web3_proxy.contains("/rpc/") {
let x = other_web3_proxy.split("/rpc/").next().unwrap();
format!("{}/health", x)
} else {
format!("{}/health", other_web3_proxy)
};
let error_sender = error_sender.clone(); let error_sender = error_sender.clone();
let loop_f = a_loop( let loop_f = a_loop(