diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-19 15:09:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-19 15:09:24 +0000 |
commit | fe96061b003b7064b3e17c468a8851784890f7b8 (patch) | |
tree | 73b0795ff52ceda3e3cf028abd4548ecdb3cf33e /src/modules/extra | |
parent | 65d4c9a057d58c4e2e86028fbbf103a7f8d625e5 (diff) |
More exception throwing in constructors
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3245 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_filter_pcre.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
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 <filter file=\"\"> 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 <filter file=\"\"> definition in your config file!\n"); - log(DEFAULT,"Error, could not find <filter file=\"\"> 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 <filter file=\"\"> definition in your config file!"); - log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!"); - return; + throw(e); } Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile); |