diff --git a/SageTools/Utils/ExtensionUtils.cs b/SageTools/Utils/ExtensionUtils.cs index 5f8ff5e..f3ec434 100644 --- a/SageTools/Utils/ExtensionUtils.cs +++ b/SageTools/Utils/ExtensionUtils.cs @@ -23,9 +23,16 @@ public static T DelayRetry(Func executeFunc, Func breakConditionF while (retryCount > 0) { retryCount--; - res = executeFunc.Invoke(); - if (breakConditionFunc.Invoke(res)) break; - Task.Delay(milliseconds).Wait(); + try + { + res = executeFunc.Invoke(); + if (breakConditionFunc.Invoke(res)) break; + Task.Delay(milliseconds).Wait(); + } + catch + { + Task.Delay(milliseconds).Wait(); + } } return res; @@ -46,9 +53,16 @@ public static async Task DelayRetryAsync(Func> executeFunc, Func 0) { retryCount--; - res = await executeFunc.Invoke(); - if (breakConditionFunc.Invoke(res)) break; - await Task.Delay(milliseconds); + try + { + res = await executeFunc.Invoke(); + if (breakConditionFunc.Invoke(res)) break; + await Task.Delay(milliseconds); + } + catch + { + Task.Delay(milliseconds).Wait(); + } } return res;