Skip to content

Commit

Permalink
tweak: remove error_from_source (#1481)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19-cw authored Jul 18, 2024
1 parent 0e211a9 commit d00ce34
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/eth/rpc/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ fn eth_estimate_gas(params: Params<'_>, ctx: Arc<RpcContext>, ext: Extensions) -
// internal error
Err(e) => {
tracing::error!(reason = ?e, "failed to execute eth_estimateGas because of unexpected error");
Err(error_with_source(e, "failed to execute eth_estimateGas"))
Err(RpcError::Unexpected(e.context("failed to execute eth_estimateGas")))
}
}
}
Expand Down Expand Up @@ -647,7 +647,7 @@ fn eth_call(params: Params<'_>, ctx: Arc<RpcContext>, ext: Extensions) -> Result
// internal error
Err(e) => {
tracing::error!(reason = ?e, "failed to execute eth_call because of unexpected error");
Err(error_with_source(e, "failed to execute eth_call"))
Err(RpcError::Unexpected(e.context("failed to execute eth_call")))
}
}
}
Expand Down Expand Up @@ -712,7 +712,7 @@ fn eth_send_raw_transaction(params: Params<'_>, ctx: Arc<RpcContext>, ext: Exten
}
Err(e) => {
tracing::error!(reason = ?e, "failed to execute eth_sendRawTransaction because of unexpected error");
Err(error_with_source(e, "failed to execute eth_sendRawTransaction"))
Err(RpcError::Unexpected(e.context("failed to execute eth_sendRawTransaction")))
}
}
}
Expand Down Expand Up @@ -968,13 +968,6 @@ fn hex_num_zero_padded(value: impl Into<U256>) -> String {
format!("{:#0width$x}", value.into(), width = width)
}

/// TODO: remove
#[inline(always)]
fn error_with_source(e: anyhow::Error, context: &str) -> RpcError {
let error_source = format!("{:?}", e.source());
e.context(format!("{} {}", context, error_source)).into()
}

fn hex_zero() -> String {
"0x0".to_owned()
}
Expand Down

0 comments on commit d00ce34

Please sign in to comment.