namespace Nebula.Shared.Utils; public static class ExceptionHelper { public static Task TryRun(Func> func, int attempts = 3, Action? attemptsCallback = null) { try { return func.Invoke(); } catch (Exception e) { if (attempts <= 0) throw new("Attempts was expired! ", e); attempts--; attemptsCallback?.Invoke(attempts, e); return TryRun(func, attempts); } } }