The crucial difference between catch when and catch { if (...) throw; }:
When you use throw; inside a catch block, the stack frame has already been unwound up to that point, altering the original call stack.
Exception Filter:
try
{
await ExecuteRemoteCallAsync();
}
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.ServiceUnavailable)
{
// Handles only 503 without unwinding if exception is 404/500!
}Exception filters evaluate the condition before the stack unwinds, preserving the pristine crash dump and stack trace in crash reports!