C
C#2mo ago
salty_pepper

Does Polly WaitAndRetryAsync() swallow exceptions during retries?

Does Polly "swallow" the exceptions during each retry attempt?
2 Replies
HtmlCompiler
HtmlCompiler2mo ago
i think you have to use Polly.Policy.Handle<Exception>()...
felsokning
felsokning2mo ago
Only if that exception is declared in the handler; otherwise, it will throw.
var retryPolicy = Policy
.Handle<FooException>()
.WaitAndRetryAsync(retryCount: 5, retryNumber => TimeSpan.FromMilliseconds(200));
var retryPolicy = Policy
.Handle<FooException>()
.WaitAndRetryAsync(retryCount: 5, retryNumber => TimeSpan.FromMilliseconds(200));
Note the .Handle<FooException> line; only FooException will be retried.
Want results from more Discord servers?
Add your server