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/configreader.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index 6cbae482f..efa67f978 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -498,8 +498,10 @@ void ServerConfig::Apply(const std::unique_ptr& old, const std::st auto binds = ConfTags("bind"); if (binds.empty()) { - errors.push_back("Possible configuration error: you have not defined any blocks."); - errors.push_back("You will need to do this if you want clients to be able to connect!"); + errors.push_back( + "You have not defined any blocks. You will need to do this " + "if you want clients to be able to connect!" + ); } if (old && valid) @@ -532,21 +534,16 @@ void ServerConfig::Apply(const std::unique_ptr& old, const std::st else fmt::print("{} ", fmt::styled("Error!", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red))); - fmt::println("There are problems with your configuration file:", fmt::styled("Error!", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red))); - fmt::println(""); + fmt::println("There are problems with your configuration file:"); } } - auto message_shown = false; auto* user = ServerInstance->Users.FindUUID(useruid); for (const auto& line : errors) { // On startup, print out to console (still attached at this point) if (!old) - { - message_shown = true; - fmt::println("{}", line); - } + fmt::println(" * {}", line); // If a user is rehashing, tell them directly if (user) @@ -556,9 +553,6 @@ void ServerConfig::Apply(const std::unique_ptr& old, const std::st ServerInstance->SNO.WriteGlobalSno('r', line); } - if (message_shown) - fmt::println(""); - errors.clear(); errors.shrink_to_fit(); -- cgit v1.3.1-10-gc9f91