From 29e7674e56bf2b829bba22def2760d034a76e788 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 11 Mar 2024 13:53:05 +0000 Subject: Replace convertTo/stringify with non-throwing alternatives. Having these throw is terrible for ergonomics and there are loads of places where the exception was either silently ignored or not handled at all. Having a function which returns an optional and another that returns a default works a lot better imo. --- modules/operserv/os_defcon.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'modules/operserv/os_defcon.cpp') diff --git a/modules/operserv/os_defcon.cpp b/modules/operserv/os_defcon.cpp index dbb0edb69..564cfec50 100644 --- a/modules/operserv/os_defcon.cpp +++ b/modules/operserv/os_defcon.cpp @@ -192,13 +192,7 @@ public: return; } - int newLevel = 0; - try - { - newLevel = convertTo(lvl); - } - catch (const ConvertException &) { } - + auto newLevel = Anope::Convert(lvl, 0); if (newLevel < 1 || newLevel > 5) { this->OnSyntaxError(source, ""); -- cgit