chore: error handling in extract_substrs

This commit is contained in:
Aditya Bisht
2024-08-31 15:36:56 +00:00
parent dd5bd7aef2
commit 3b626316b0

View File

@@ -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![];