Skip to content

Commit

Permalink
chore: error handling in extract_substrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisht13 committed Aug 31, 2024
1 parent dd5bd7a commit 3b62631
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/apis/src/extract_substrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ pub fn extract_substr_idxes(
input_str.to_string(),
)
})?
.expect("Expected a match, but none was found");
.ok_or_else(|| {
ExtractSubstrssError::SubstringOfEntireNotFound(
entire_regex.clone(),
input_str.to_string(),
)
})?;

let mut public_idxes = vec![];

Expand Down

0 comments on commit 3b62631

Please sign in to comment.