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 <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
Christoph Rüthing 2025-09-28 12:10:50 +02:00 committed by GitHub
parent 813e26e3b4
commit 4cbc601a69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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