From 4cbc601a69d8acc980e476eda8607a80845e59cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BCthing?= Date: Sun, 28 Sep 2025 12:10:50 +0200 Subject: [PATCH] Allow easy Creation of Generic Exceptions with just a Text (#1192) * Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or() Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or() * Updated version and release notes * Updated version and release notes * Remove noexcept from delegate method stubs. (#1185) In addition to removing noexcept from call_if, this is also needed to prevent an abort when cancelling a pthread that is executing a delegate. * Updated version and release notes * Allow easy Creation of Generic Exceptions with just a Text Today when using ETL_ASSERT you need to pass a concrete exception type. However, it can be quite unhandy to define a custom exception type for each assert, therefore we want to also allow to simply use the generic etl::exception type and directly provide the message. --------- Co-authored-by: John Wellbelove Co-authored-by: Marco Nilsson Co-authored-by: John Wellbelove --- include/etl/error_handler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/etl/error_handler.h b/include/etl/error_handler.h index da3959cb..38c655b4 100644 --- a/include/etl/error_handler.h +++ b/include/etl/error_handler.h @@ -448,10 +448,12 @@ namespace etl #define ETL_ERROR(e) (e(__FILE__, __LINE__)) // Make an exception with the file name and line number. #define ETL_ERROR_WITH_VALUE(e, v) (e(__FILE__, __LINE__, (v))) // Make an exception with the file name, line number and value. #define ETL_ERROR_TEXT(verbose_text, terse_text) (verbose_text) // Use the verbose text. + #define ETL_ERROR_UNTYPED(text) (etl::exception((text),__FILE__,__LINE__)) // Make a generic exception with a message, file name and line number. #else #define ETL_ERROR(e) (e("", __LINE__)) // Make an exception with the line number. #define ETL_ERROR_WITH_VALUE(e, v) (e("", __LINE__, (v))) // Make an exception with the file name, line number and value. #define ETL_ERROR_TEXT(verbose_text, terse_text) (terse_text) // Use the terse text. + #define ETL_ERROR_UNTYPED(text) (etl::exception((text),"",__LINE__)) // Make a generic exception with a message and line number. #endif #endif