From a6fce94fbe15ba324621e41676e291cf9702735d Mon Sep 17 00:00:00 2001 From: Cody Nelson <48865103+Cody-Nelson@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:03:14 -0700 Subject: [PATCH 1/2] Fix callback errors breaking `retryWithDelay` --- lib/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.lua b/lib/init.lua index dc82ad5..87ea2f5 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -1880,7 +1880,7 @@ function Promise.retryWithDelay(callback, times, seconds, ...) local args, length = { ... }, select("#", ...) - return Promise.resolve(callback(...)):catch(function(...) + return Promise.try(callback, ...):catch(function(...) if times > 0 then Promise.delay(seconds):await() From 8477656afd5909e4d82950a173566065b2bd8695 Mon Sep 17 00:00:00 2001 From: Cody Nelson <48865103+Cody-Nelson@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:10:56 -0700 Subject: [PATCH 2/2] Fix callback errors breaking `retry` --- lib/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.lua b/lib/init.lua index 87ea2f5..b974659 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -1851,7 +1851,7 @@ function Promise.retry(callback, times, ...) local args, length = { ... }, select("#", ...) - return Promise.resolve(callback(...)):catch(function(...) + return Promise.try(callback, ...):catch(function(...) if times > 0 then return Promise.retry(callback, times - 1, unpack(args, 1, length)) else