From 12b9291384b92a072089015102ae750625ef8521 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 19 Feb 2006 15:00:23 +0000 Subject: Added exception thrower git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3243 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_censor.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') 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 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 definition in your config file!"); - log(DEFAULT,"Error, could not find 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 definition in your config file!\n"); - log(DEFAULT,"Error, could not find definition in your config file!"); + CensorException e; + throw(e); } Srv->Log(DEFAULT,std::string("m_censor: read configuration from ")+Censorfile); } -- cgit v1.2.3