On Fri, Jun 26, 2026 at 3:11 AM Rainer Deyke via Boost < boost@lists.boost.org> wrote:
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
Yes, when using LEAF, jumping between threads requires that the error objects are collected and later released in the error handling thread. Just like std::exception_ptr can capture an exception object, leaf::result can capture any number of error objects (plus a C++ exception, if present).