Skip to content

Commit 1c092f6

Browse files
committed
remove try/catch
1 parent fe256d7 commit 1c092f6

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

src/url_pattern.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -729,23 +729,16 @@ std::string generate_segment_wildcard_regexp(
729729
}
730730

731731
bool protocol_component_matches_special_scheme(
732-
ada::url_pattern_component& component) {
732+
url_pattern_component& component) {
733733
auto regex = component.get_regexp();
734734
ada_log("protocol_component_matches_special_scheme regex: ", regex);
735-
try {
736-
std::regex rx(regex.data(), regex.size());
737-
std::cmatch cmatch;
738-
return std::regex_match("http", cmatch, rx) ||
739-
std::regex_match("https", cmatch, rx) ||
740-
std::regex_match("ws", cmatch, rx) ||
741-
std::regex_match("wss", cmatch, rx) ||
742-
std::regex_match("ftp", cmatch, rx);
743-
} catch (...) {
744-
// You probably want to log this error.
745-
ada_log("Error while matching protocol component with special scheme");
746-
ada_log("Regex Input: ", regex);
747-
return false;
748-
}
735+
std::regex rx(regex.data(), regex.size());
736+
std::cmatch cmatch;
737+
return std::regex_match("http", cmatch, rx) ||
738+
std::regex_match("https", cmatch, rx) ||
739+
std::regex_match("ws", cmatch, rx) ||
740+
std::regex_match("wss", cmatch, rx) ||
741+
std::regex_match("ftp", cmatch, rx);
749742
}
750743

751744
} // namespace url_pattern_helpers

0 commit comments

Comments
 (0)