I have a C# task that I'd like to re run if a certain exception type is thrown.
This is what I have currently:
bool retry = true;
int numOfRetries = 3;
int tries;
while (retry = true && tries <= numOfRetries)
{
try
{
//Task
retry = false;
}
catch (Exception e)
{
if (e.Message.Contains("Unique exception Id like to retry on")
{
tries++;
}
else
{
retry = false;
log(e);
}
}
}