From 76a899627ecff1f4fa3644ee06d8e1d279634850 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Fri, 17 Jan 2025 18:24:10 +0100 Subject: [PATCH] regex: log an error if regex parsing fails --- src/desktop/Rule.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/desktop/Rule.cpp b/src/desktop/Rule.cpp index dd1848d4..ae280642 100644 --- a/src/desktop/Rule.cpp +++ b/src/desktop/Rule.cpp @@ -1,11 +1,16 @@ #include "Rule.hpp" #include +#include "../debug/Log.hpp" CRuleRegexContainer::CRuleRegexContainer(const std::string& regex_) { const bool NEGATIVE = regex_.starts_with("negative:"); negative = NEGATIVE; regex = std::make_unique(NEGATIVE ? regex_.substr(9) : regex_); + + // TODO: maybe pop an error? + if (!regex->ok()) + Debug::log(ERR, "RuleRegexContainer: regex {} failed to parse!", regex_); } bool CRuleRegexContainer::passes(const std::string& str) const {