StackExchange.Metrics
StackExchange.Metrics copied to clipboard
Don't throw on connection failure if ThrowOnPostFail is false
Right now, ThrowOnPostFail only applies to >= 500 status codes, but it should also apply if the connection is unavailable.
Looking at the code, you can set a handler which will stop it from throwing.
MetricsCollector.OnBackgroundException +=
@wilson85 those are orthogonal. The background exception handler catches anything that throws and sends it somewhere that won't crash the background thread (and potentially the process). The ThrowOnPostFails deals with whether an exception gets sent anywhere (regardless of whether it's truly thrown or sent to the exception handler).
It should probably be renamed to TreatPostFailAsError or something like that in the future to make it less confusing.