C
C#4mo ago
salty_pepper

Does Polly WaitAndRetryAsync() swallow exceptions during retries?

Does Polly "swallow" the exceptions during each retry attempt?
2 Replies
FestivalDelGelato
i think you have to use Polly.Policy.Handle<Exception>()...
felsokning
felsokning4mo 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.

Did you find this page helpful?