I'm having a little trouble finishing up my retry logic code. However, I can't figure the missing part. How do I catch and log when it fails and make it retry again with a timer.
Heres my code.
while (true)
{
var res = await this.httpClientWrapper.......
if (res.IsSuccessStatusCode)
{
var result = await res.Content.......
this.logger.Info($".......
}
if (result.status == "Succesed")
{
return true;
}
else
{
var resContent = await.......
this.logger.Info($.......
await Task.Delay(2000).ConfigureAwait(false);
throw new Exception(resContent);
}
}