From a2981a9e35ab987a621d8ac8bb1b85e424939c48 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 19 Jun 2026 13:00:58 +0100 Subject: Rework error reporting and shutting down. - Clean up InspIRCd::Cleanup and document it better. - Bring back QuickExit for error reporting during shutdown. - Deduplicate logging of error messages to stdout and files. --- src/modules.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index 4f9586773..b465a5044 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -522,7 +522,7 @@ void ModuleManager::LoadAll() if (!this->Load(name, true)) { fmt::println("[{}] {}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red)), LastError()); - ServerInstance->Exit(EXIT_FAILURE); + ServerInstance->Exit(EXIT_FAILURE, "A module failed to load"); } } @@ -541,7 +541,7 @@ void ModuleManager::LoadAll() LastModuleError = "Unable to initialize " + modname + ": " + modexcept.GetReason(); ServerInstance->Logs.Critical("MODULE", LastModuleError); fmt::println("[{}] {}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red)), LastModuleError); - ServerInstance->Exit(EXIT_FAILURE); + ServerInstance->Exit(EXIT_FAILURE, "A module failed to initialize"); } } @@ -563,12 +563,12 @@ void ModuleManager::LoadAll() LastModuleError = "Unable to read the configuration for " + modname + ": " + modexcept.GetReason(); ServerInstance->Logs.Critical("MODULE", LastModuleError); fmt::println("[{}] {}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red)), LastModuleError); - ServerInstance->Exit(EXIT_FAILURE); + ServerInstance->Exit(EXIT_FAILURE, "A module has invalid configuration"); } } if (!PrioritizeHooks()) - ServerInstance->Exit(EXIT_FAILURE); + ServerInstance->Exit(EXIT_FAILURE, "Unable to prioritise module hooks", "MODULE"); } std::string& ModuleManager::LastError() -- cgit v1.3.1-10-gc9f91