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_codepage.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/modules/m_codepage.cpp') diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 5d75e18d7..78b67bcf1 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -262,18 +262,18 @@ class ModuleCodepage final const std::string name = codepagetag->getString("name"); if (name.empty()) - throw ModuleException(" is a required field!"); + throw ModuleException(this, " is a required field!"); std::unique_ptr newcodepage = std::make_unique(); for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars")) { unsigned long begin = tag->getUInt("begin", tag->getUInt("index", 0)); if (!begin) - throw ModuleException(" tag without index or begin specified at " + tag->source.str()); + throw ModuleException(this, " tag without index or begin specified at " + tag->source.str()); unsigned long end = tag->getUInt("end", begin); if (begin > end) - throw ModuleException(" must be lower than at " + tag->source.str()); + throw ModuleException(this, " must be lower than at " + tag->source.str()); bool front = tag->getBool("front", false); for (unsigned long pos = begin; pos <= end; ++pos) @@ -287,11 +287,11 @@ class ModuleCodepage final break; case Codepage::ACR_NOT_VALID: - throw ModuleException(InspIRCd::Format(" tag contains a forbidden character: %lu at %s", + throw ModuleException(this, InspIRCd::Format(" tag contains a forbidden character: %lu at %s", pos, tag->source.str().c_str())); case Codepage::ACR_NOT_VALID_AT_FRONT: - throw ModuleException(InspIRCd::Format(" tag contains a forbidden front character: %lu at %s", + throw ModuleException(this, InspIRCd::Format(" tag contains a forbidden front character: %lu at %s", pos, tag->source.str().c_str())); } } @@ -301,14 +301,14 @@ class ModuleCodepage final { unsigned long lower = tag->getUInt("lower", 0); if (!lower) - throw ModuleException(" is required at " + tag->source.str()); + throw ModuleException(this, " is required at " + tag->source.str()); unsigned long upper = tag->getUInt("upper", 0); if (!upper) - throw ModuleException(" is required at " + tag->source.str()); + throw ModuleException(this, " is required at " + tag->source.str()); if (!newcodepage->Map(upper, lower)) - throw ModuleException("Malformed tag at " + tag->source.str()); + throw ModuleException(this, "Malformed tag at " + tag->source.str()); ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Marked %lu (%.4s) as the lower case version of %lu (%.4s)", lower, reinterpret_cast(&lower), upper, reinterpret_cast(&upper)); -- cgit v1.3.1-10-gc9f91