public static void TryExecute(Action action, IRequestRetryStrategy retryStrategy, PatchKit.Unity.Patcher.Cancellation.CancellationToken cancellationToken) { do { try { action(); return; } catch (IOException e) { retryStrategy.OnRequestFailure(); if (!retryStrategy.ShouldRetry) { DebugLogger.LogError(string.Format("An IO Exception has occured: {0}. rethrowing.", e)); throw; } DebugLogger.LogWarning(string.Format("An IO Exception has occured: {0}. retrying...", e)); Threading.CancelableSleep(retryStrategy.DelayBeforeNextTry, cancellationToken); } } while (retryStrategy.ShouldRetry); }