I am trying to implement within a constructor the Polly for handling HTTP error statuses, but I get an error saying:
The non-generic method cannot be used with type arguments.
I used the code from their website though. Here it is:
public BaseApiManager()
{
Retry = Policy.HandleResult<HttpResponseMessage>(r => r.StatusCode == HttpStatusCode.InternalServerError)
.OrResult<HttpResponseMessage>(r => r.StatusCode == HttpStatusCode.BadGateway)
.WaitAndRetry(3, retryAttempt => TimeSpan.FromSeconds(5));
}
The error is on the second line, at the OrResult
. I also tried using it with ApiResponse<T>
, which is my generic class, but it does not work as well.
What am I doing wrong ?