From ec4e2ec0ec6261a402c71cc8d803c2d30bb3b48c Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 20 Mar 2026 14:05:41 +0100 Subject: Fixing up errors from streamlining error class --- modules/core/c++/error.cpp | 9 +++++++++ modules/core/c++/error.hpp | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'modules/core') diff --git a/modules/core/c++/error.cpp b/modules/core/c++/error.cpp index d5132ac..6bb939e 100644 --- a/modules/core/c++/error.cpp +++ b/modules/core/c++/error.cpp @@ -157,6 +157,15 @@ error_or error_registry::search_or_register_id(const std::string_vi return std::move(err); } + +bool error_registry::is_critical(error::code cd) const { + return infos_.at(cd).is_critical; +} +} + +error make_error(error::code cd, const std::string_view& generic){ + auto& reg = impl::get_error_registry(); + return error{cd, reg.is_critical(cd), generic}; } } // namespace saw diff --git a/modules/core/c++/error.hpp b/modules/core/c++/error.hpp index ceef3c2..2a97a8b 100644 --- a/modules/core/c++/error.hpp +++ b/modules/core/c++/error.hpp @@ -123,6 +123,8 @@ public: error_or search_id(const std::string_view& desc) const; error_or search_or_register_id(const std::string_view& desc, bool is_critical); + + bool is_critical(error::code cd) const; }; error_registry& get_error_registry(); @@ -150,14 +152,14 @@ error make_error(error::code code, const std::string_view &generic); template error make_error(const std::string_view& generic){ error::code id = impl::get_template_error_id(); - - return make_error(id, generic); + // Keep error, don't use make_error + return error{id, T::is_critical, generic}; } template error make_error(){ error::code id = impl::get_template_error_id(); - - return make_error(id, {}); + // Keep error, don't use make_error + return error{id, T::is_critical}; } struct error_builder { -- cgit v1.2.3