From fe96061b003b7064b3e17c468a8851784890f7b8 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 19 Feb 2006 15:09:24 +0000 Subject: More exception throwing in constructors git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3245 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_filter_pcre.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index f6ec64d6c..fe3d721d4 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -28,6 +28,15 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" +class FilterPCREException +{ + public: + virtual char* GetReason() + { + return "Could not find definition in your config file!"; + } +}; + /* $ModDesc: m_filter with regexps */ /* $CompileFlags: -I/usr/local/include */ /* $LinkerFlags: -L/usr/local/lib -lpcre */ @@ -56,9 +65,8 @@ class ModuleFilterPCRE : public Module MyConf = new ConfigReader(filterfile); if ((filterfile == "") || (!MyConf->Verify())) { - printf("Error, could not find definition in your config file!\n"); - log(DEFAULT,"Error, could not find definition in your config file!"); - return; + FilterPCREException e; + throw(e); } Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile); @@ -156,10 +164,9 @@ class ModuleFilterPCRE : public Module MyConf = new ConfigReader(filterfile); if ((filterfile == "") || (!MyConf->Verify())) { + FilterPCREException e; // bail if the user forgot to create a config file - printf("Error, could not find definition in your config file!"); - log(DEFAULT,"Error, could not find definition in your config file!"); - return; + throw(e); } Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile); -- cgit v1.2.3