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...). -- Rainer Deyke - rainerd@eldwood.com