From 0e7f74a7c8e804a0223b4d88bf637649838f0412 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 27 Aug 2013 07:29:13 +0100 Subject: Make all regex modules throw the same exception on error. --- include/modules/regex.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') 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) { } +}; -- cgit v1.2.3