diff options
author | Sadie Powell <sadie@witchery.services> | 2024-05-09 18:34:32 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-05-09 18:37:16 +0100 |
commit | 33a02b12239a9dd1ee6e41ab4de07a544c7aa6ae (patch) | |
tree | fb93d5e649c276b41ccb58751c4a195aeebcb2df | |
parent | 68f4556609569a33c4fcf1bf67402db292d4bdeb (diff) |
Require a reason when throwing an exception.
-rw-r--r-- | include/anope.h | 7 | ||||
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | modules/redis.cpp | 2 |
3 files changed, 3 insertions, 8 deletions
diff --git a/include/anope.h b/include/anope.h index 942952857..8d58acdce 100644 --- a/include/anope.h +++ b/include/anope.h @@ -717,9 +717,6 @@ protected: */ Anope::string source; public: - /** Default constructor, just uses the error message 'Core threw an exception'. - */ - CoreException() : err("Core threw an exception"), source("The core") { } /** This constructor can be used to specify an error message before throwing. */ CoreException(const Anope::string &message) : err(message), source("The core") { } @@ -750,10 +747,6 @@ class CoreExport ModuleException : public CoreException { public: - /** Default constructor, just uses the error message 'Module threw an exception'. - */ - ModuleException() : CoreException("Module threw an exception", "A Module") { } - /** This constructor can be used to specify an error message before throwing. */ ModuleException(const Anope::string &message) : CoreException(message, "A Module") { } diff --git a/include/modules.h b/include/modules.h index 8723e623c..e26c0b4cf 100644 --- a/include/modules.h +++ b/include/modules.h @@ -199,6 +199,8 @@ public: class CoreExport NotImplementedException final : public CoreException { +public: + NotImplementedException() : CoreException("") { } }; /** Every module in Anope is actually a class. diff --git a/modules/redis.cpp b/modules/redis.cpp index 4e006c9ff..fbaa3bff5 100644 --- a/modules/redis.cpp +++ b/modules/redis.cpp @@ -237,7 +237,7 @@ public: void StartTransaction() override { if (in_transaction) - throw CoreException(); + throw ModuleException("Tried to start a transaction while one was already in progress"); this->SendCommand(NULL, "MULTI"); in_transaction = true; |