Skip to content

Commit

Permalink
Add new regex
Browse files Browse the repository at this point in the history
  • Loading branch information
kkawula committed Oct 24, 2024
1 parent 12d2bd4 commit f171255
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pub fn try_extract_panic_data(err: &str) -> Option<Vec<Felt252>> {
let re_string = Regex::new(r#"(?s)Execution failed\. Failure reason: "(.*?)"\."#)
.expect("Could not create string panic_data matching regex");

let re_entry_point =
Regex::new(r"Entry point EntryPointSelector\((0x[0-9a-fA-F]+)\) not found in contract\.")
.unwrap();

if let Some(captures) = re_felt_array.captures(err) {
if let Some(panic_data_match) = captures.get(1) {
let panic_data_felts: Vec<Felt252> = panic_data_match
Expand All @@ -31,6 +35,16 @@ pub fn try_extract_panic_data(err: &str) -> Option<Vec<Felt252>> {
}
}

if let Some(captures) = re_entry_point.captures(err) {
if let Some(_selector) = captures.get(1) {
let panic_data_felts = vec![
Felt252::from_bytes_be_slice("ENTRYPOINT_NOT_FOUND".as_bytes()),
Felt252::from_bytes_be_slice("ENTRYPOINT_FAILED".as_bytes()),
];
return Some(panic_data_felts);
}
}

None
}

Expand Down

0 comments on commit f171255

Please sign in to comment.