mattiasflodin/reckless

error_policy::fail_immediately should not necessarily mean that the error is fatal

Closed this issue · 1 comments

Reckless wrongly considers the notify_on_recovery/fail_immediately error policies for temporary/permanent errors to be indicative of whether an error is "fatal" (i.e. permanent) or not. If the error policy for temporary errors is fail_immediately then writer errors will be thrown as fatal_flush_error and the background thread is shut down. This is bad if you're interested in immediate delivery of errors in the form of exceptions, but still wish to continue using the logger.

We should offer a variant of write() that writes to an error_code and does not throw exceptions, and we shouldn't terminate the background thread just because the policy is fail_immediately. We can terminate the thread on permanent errors, but the important thing is that fail_immediately should only control whether basic_log::fatal_error_code (which should be renamed) is set or not.

Resolved by only looking at the error policy and not caring about the error classification.