On Sat, May 27, 2017 at 9:35 AM, Andrzej Krzemienski via Boost < boost@lists.boost.org> wrote:
But whatever the answer, we are arriving at the "nested failure" problem: we are processing a (potential) failure report, and this processing fails. What should we do? report the new error condition and ignore the previous?
You should always report the immediate failure not the failure you failed to report, because this is a different failure that may require a different handler. Practically speaking what could go wrong when trying to report an error is that you might run out of memory. So you must be able to report out of memory conditions without running out of memory. This is also how C++ exception handling works, in general throwing an exception may require memory allocation (not necessarily from the heap) which may fail, in which case std::bad_alloc will be thrown instead. This also trivially follows from RAII. It's good to know that the objects you are working with are good and complete, and exceptions or other objects that communicate failures are no exception.