diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-19 15:00:23 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-19 15:00:23 +0000 |
commit | 12b9291384b92a072089015102ae750625ef8521 (patch) | |
tree | a577bf2d5272dc22ea13219f3727ab3da177f3d0 | |
parent | 6824a483e3bc4a584b998929ac066dda2ae24c8b (diff) |
Added exception thrower
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3243 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_censor.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index a1a8581a2..ed576302b 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -25,6 +25,14 @@ using namespace std; /* $ModDesc: Provides user and channel +G mode */ +class CensorException : public ModuleException +{ + virtual char* GetReason() + { + return "Could not find <censor file=\"\"> definition in your config file!"; + } +}; + class ModuleCensor : public Module { Server *Srv; @@ -52,9 +60,8 @@ class ModuleCensor : public Module MyConf = new ConfigReader(Censorfile); if ((Censorfile == "") || (!MyConf->Verify())) { - printf("Error, could not find <censor file=\"\"> definition in your config file!"); - log(DEFAULT,"Error, could not find <censor file=\"\"> definition in your config file!"); - return; + CensorException e; + throw(e); } Srv->Log(DEFAULT,std::string("m_censor: read configuration from ")+Censorfile); Srv->AddExtendedMode('G',MT_CHANNEL,false,0,0); @@ -157,9 +164,8 @@ class ModuleCensor : public Module MyConf = new ConfigReader(Censorfile); if ((Censorfile == "") || (!MyConf->Verify())) { - // bail if the user forgot to create a config file - printf("Error, could not find <censor file=\"\"> definition in your config file!\n"); - log(DEFAULT,"Error, could not find <censor file=\"\"> definition in your config file!"); + CensorException e; + throw(e); } Srv->Log(DEFAULT,std::string("m_censor: read configuration from ")+Censorfile); } |