3 ms·
I have seen that using error singletones together with logging at the point of error worked rather nicely. Surely as a global state it is not thread safe, but w
by fpoling 9y ago
I have seen that using error singletones together with logging at the point of error worked rather nicely. Surely as a global state it is not thread safe, but when the state belongs to a component with well defined API and uses once an error, always an error strategy so error recovery requires constructing a new component, then thread-safety is trivial to address.
A bonus of this approach is that error path through code is the same as for the non-error case. Thus getting good coverage for error cases in unit and integration tests is easier.