summaryrefslogtreecommitdiff
path: root/src/modules/m_randquote.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-19 15:21:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-19 15:21:51 +0000
commit1328556e3690aa7a6c6003373221c4cc914c1d4d (patch)
tree9937918b7ff76424726a949d34edbc1ba38f3dc0 /src/modules/m_randquote.cpp
parentfe96061b003b7064b3e17c468a8851784890f7b8 (diff)
Server::AddExtendedMode and Server::AddCommand will now throw exceptions when adding a bad mode or already existing command. If the module constructor does not handle this exception, this will abort the module's constructor, forbidding loading of modules which are unable to function (smart eh)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3246 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_randquote.cpp')
-rw-r--r--src/modules/m_randquote.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 08de8876d..8ee07f242 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -62,6 +62,18 @@ class cmd_randquote : public command_t
}
};
+class RandquoteException : public ModuleException
+{
+ private:
+ std::string err;
+ public:
+ RandquoteException(std::string message) : err(message) { }
+
+ virtual char* GetReason()
+ {
+ return (char*)err.c_str();
+ }
+}
class ModuleRandQuote : public Module
{
@@ -85,15 +97,15 @@ class ModuleRandQuote : public Module
if (q_file == "")
{
- log(DEFAULT,"m_randquote: Quotefile not specified - Please check your config.");
- return;
+ RandquoteException e("m_randquote: Quotefile not specified - Please check your config.");
+ throw(e);
}
quotes = new FileReader(q_file);
if(!quotes->Exists())
{
- log(DEFAULT,"m_randquote: QuoteFile not Found!! Please check your config - module will not function.");
- return;
+ RandquoteException e("m_randquote: QuoteFile not Found!! Please check your config - module will not function.");
+ throw(e);
}
else
{