Re: What an error message must do

Rainer Deyke via Boost <[email protected]> Fri, 26 Jun 2026 09:10:34 +0200
Newsgroups gmane.comp.lib.boost.devel
Message-ID <[email protected]>
On 6/25/26 23:16, Emil Dotchevski via Boost wrote:
> Look at Boost LEAF, it lets you communicate arbitrary context with any
> error, with or without exceptions.
> 
> You can associate arbitrary context with any failure, the error objects are
> communicated with type safety. At an error handling scope you have the
> option to format a user-friendly message based on the available data, or an
> automatic developer-friendly message, or to serialize everything into a
> machine-readable format (nlohmann and Boost.JSON are directly supported,
> but the serialization API is extensible.)

A word of warning about LEAF: it uses thread-local storage in a way that 
is incompatible with thread-jumping code, including but not limited to 
Boost.Fiber and the proposed Boost.Capy, and possibly C++ coroutines in 
general.  This problem was noted when LEAF was first reviewed, but it 
has gotten much worse with the introduction of C++ coroutines.  This 
limitation is mentioned in the LEAF documentation, but you have to look 
a bit to find it and read between the lines to understand its full 
implications.  (The relevant documentation section is 
https://www.boost.org/doc/libs/latest/libs/leaf/doc/html/index.html#tutorial-async).


-- 
Rainer Deyke - [email protected]

_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/32IYLSLH2T7KVU3AUCWADRQFTNXGOHHX/