Skip to content

Commit

Permalink
Don't unwrap regex match error
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasschafer committed Dec 13, 2024
1 parent 8c68ee1 commit a13695a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parsed_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ impl ParsedFields {
}
}
SearchType::PatternAdvanced(ref p) => {
if p.is_match(&line).unwrap() {
Some(p.replace_all(&line, &self.replace_string).to_string())
} else {
None
// TODO: try catch
match p.is_match(&line) {
Ok(true) => Some(p.replace_all(&line, &self.replace_string).to_string()),
_ => None,
}
}
};
Expand Down

0 comments on commit a13695a

Please sign in to comment.