From 9eec329ebdf4cf079619edb58dbcd78ce42b8626 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 18 Nov 2025 07:44:48 +0100 Subject: feat: lib: error_handler improvements, new method. FIX module improvements. Signed-off-by: Amlal El Mahrouss --- dev/lib/core/error_handler.hpp | 13 ++++++++++++- dev/lib/core/includes.hpp | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'dev/lib/core') diff --git a/dev/lib/core/error_handler.hpp b/dev/lib/core/error_handler.hpp index 67bf7b4..4234721 100644 --- a/dev/lib/core/error_handler.hpp +++ b/dev/lib/core/error_handler.hpp @@ -23,7 +23,18 @@ namespace ocl basic_error_handler& operator=(const basic_error_handler&) = delete; basic_error_handler(const basic_error_handler&) = delete; - virtual void operator()(const std::basic_string& msg) + template + void error(const std::basic_string& msg) + { + this->operator()(msg); + + if constexpr (throw_too) + { + throw std::runtime_error(msg); + } + } + + void operator()(const std::basic_string& msg) { ocl::io::print(msg); } diff --git a/dev/lib/core/includes.hpp b/dev/lib/core/includes.hpp index ff59535..78eccd3 100644 --- a/dev/lib/core/includes.hpp +++ b/dev/lib/core/includes.hpp @@ -12,3 +12,12 @@ #include #include #include + +namespace ocl +{ +#ifdef OCL_USE_UTF8 + using char_type = char8_t; +#else + using char_type = char; +#endif +} // namespace ocl \ No newline at end of file -- cgit v1.2.3