Skip to content

Commit

Permalink
fix: ignore chain specific error.
Browse files Browse the repository at this point in the history
  • Loading branch information
andysim3d committed Oct 15, 2024
1 parent b995209 commit c2ada02
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions crates/provider/src/alloy/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ where
method_logger.record_http(HttpCode::TwoHundreds);
method_logger.record_rpc(get_rpc_status_code(resp));
if resp.is_error() {
tracing::error!(
"alloy provider of method {} response with error: {}",
&method_name,
resp.as_error().unwrap()
);
let error = resp.as_error().unwrap();
if error.code < 0 {
tracing::error!(
"alloy provider of method {} response with error: {}",
&method_name,
error
);
}
}
}
Err(e) => {
Expand Down Expand Up @@ -152,6 +155,7 @@ fn get_rpc_status_from_code(code: i64) -> RpcCode {
-32602 => RpcCode::InvalidParams,
-32603 => RpcCode::InternalError,
x if (-32099..=-32000).contains(&x) => RpcCode::ServerError,
x if x >= 0 => RpcCode::Success,
_ => RpcCode::Other,
}
}
Expand Down

0 comments on commit c2ada02

Please sign in to comment.