Skip to content

Commit c1b612f

Browse files
committed
Return error instead of panic
1 parent c348f32 commit c1b612f

File tree

1 file changed

+3
-3
lines changed
  • core/node/api_server/src/web3/namespaces

1 file changed

+3
-3
lines changed

core/node/api_server/src/web3/namespaces/eth.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,12 @@ impl EthNamespace {
405405
let marker = BytecodeMarker::new(contract_code.bytecode_hash);
406406
let prepared_bytecode = if marker == Some(BytecodeMarker::Evm) {
407407
trim_padded_evm_bytecode(
408-
BytecodeHash::try_from(contract_code.bytecode_hash).unwrap_or_else(|_| {
409-
panic!(
408+
BytecodeHash::try_from(contract_code.bytecode_hash).with_context(|| {
409+
format!(
410410
"Invalid bytecode hash at address {address:?}: {:?}",
411411
contract_code.bytecode_hash
412412
)
413-
}),
413+
})?,
414414
&contract_code.bytecode,
415415
)
416416
.with_context(|| {

0 commit comments

Comments
 (0)