summaryrefslogtreecommitdiff
path: root/include/modules/regex.h
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-08-27 07:29:13 +0100
committerPeter Powell <petpow@saberuk.com>2013-08-27 12:07:49 +0100
commit0e7f74a7c8e804a0223b4d88bf637649838f0412 (patch)
tree79e0ff4d3ae3cb96ff65c52490d19afaec4916cd /include/modules/regex.h
parentd9d9cbe025f94523265daa72de7596467d71f5c8 (diff)
Make all regex modules throw the same exception on error.
Diffstat (limited to 'include/modules/regex.h')
-rw-r--r--include/modules/regex.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/modules/regex.h b/include/modules/regex.h
index 875f942bc..e278df502 100644
--- a/include/modules/regex.h
+++ b/include/modules/regex.h
@@ -53,3 +53,13 @@ class RegexFactory : public DataProvider
virtual Regex* Create(const std::string& expr) = 0;
};
+
+class RegexException : public ModuleException
+{
+ public:
+ RegexException(const std::string& regex, const std::string& error)
+ : ModuleException("Error in regex '" + regex + "': " + error) { }
+
+ RegexException(const std::string& regex, const std::string& error, int offset)
+ : ModuleException("Error in regex '" + regex + "' at offset " + ConvToStr(offset) + ": " + error) { }
+};