include code in the error message

This commit is contained in:
Bryan Stitt 2023-01-25 14:59:11 -08:00
parent 43b5652ba8
commit 315ac4838d

View File

@ -60,6 +60,8 @@ pub async fn main(
.context(format!("error querying block from {}", rpc))
.map_err(|x| error_builder.build(x))?;
// TODO: if !a.status().is_success()
// TODO: capture response headers now in case of error. store them in the extra data on the pager duty alert
let headers = format!("{:#?}", a.headers());
@ -74,7 +76,7 @@ pub async fn main(
} else if let Some(err) = a.error {
return error_builder.result(
anyhow::anyhow!("headers: {:#?}. err: {:#?}", headers, err)
.context(format!("jsonrpc error from {}", rpc)),
.context(format!("jsonrpc error from {}: code {}", rpc, err.code)),
);
} else {
return error_builder