From 52cc8a418307ae7a551d23e6bd2d367b544e7bf9 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 7 Jan 2022 17:12:42 +0000 Subject: Refactor CoreException and ModuleException. --- src/modules/m_rline.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/modules/m_rline.cpp') diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index e52224738..bc599147a 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -97,9 +97,15 @@ class RLine final class RLineFactory final : public XLineFactory { - public: + private: + const Module* creator; Regex::EngineReference& rxfactory; - RLineFactory(Regex::EngineReference& rx) : XLineFactory("R"), rxfactory(rx) + + public: + RLineFactory(const Module* mod, Regex::EngineReference& rx) + : XLineFactory("R") + , creator(mod) + , rxfactory(rx) { } @@ -110,7 +116,7 @@ class RLineFactory final if (!rxfactory) { ServerInstance->SNO.WriteToSnoMask('a', "Cannot create regexes until engine is set to a loaded provider!"); - throw ModuleException("Regex engine not set or loaded!"); + throw ModuleException(creator, "Regex engine not set or loaded!"); } return new RLine(set_time, duration, source, reason, xline_specific_mask, rxfactory); @@ -213,7 +219,7 @@ class ModuleRLine final : Module(VF_VENDOR | VF_COMMON, "Adds the /RLINE command which allows server operators to prevent users matching a nickname!username@hostname+realname regular expression from connecting to the server.") , Stats::EventListener(this) , rxfactory(this) - , f(rxfactory) + , f(this, rxfactory) , r(this, f) { } -- cgit v1.3.1-10-gc9f91