Skip to content

Commit

Permalink
fix: error handling (#1150)
Browse files Browse the repository at this point in the history
fix error handling
  • Loading branch information
greged93 authored Jun 3, 2024
1 parent df8ae79 commit 46d630d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/eth_provider/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ impl From<Vec<FieldElement>> for EvmError {

fn decode_err(bytes: &[u8]) -> String {
// Skip the first 4 bytes which is the function selector
let msg = &bytes[4..];
let maybe_decoded_msg = alloy_sol_types::sol_data::String::abi_decode(msg, true);
maybe_decoded_msg.map_or_else(|_| format!("{}", bytes.iter().collect::<Bytes>()), |s| s)
let msg = &bytes.get(4..);
let maybe_decoded_msg = msg.and_then(|msg| alloy_sol_types::sol_data::String::abi_decode(msg, true).ok());
maybe_decoded_msg.map_or_else(|| format!("{}", bytes.iter().collect::<Bytes>()), |s| s)
}

/// Error related to a transaction.
Expand Down

0 comments on commit 46d630d

Please sign in to comment.