From 2ac25bd37dce9be41f6653caf2eed88c82a43c10 Mon Sep 17 00:00:00 2001 From: James Onnen Date: Wed, 29 Jul 2026 17:58:39 -0700 Subject: [PATCH] fix(contentproviderutils): reject ImageLabelLoaded with a real reason PromiseLoaded() rejected with no value on both the default-timeout path and the image-label-changed path, so callers logging the rejection printed "nil" and had nothing to debug with. The one message that did exist was also on the wrong branch: it blamed the "default timeout time" only when an explicit timeout had been passed. Both paths now reject with a message naming what happened, and the timeout message includes the timeout that elapsed. CircleCover is the only caller in-tree and already routes the reason to a warn. Claude-Session: https://claude.ai/code/session_01W7ZXw5EYfJ7uJeKUFrDivM --- .../src/Client/ImageLabelLoaded.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/contentproviderutils/src/Client/ImageLabelLoaded.lua b/src/contentproviderutils/src/Client/ImageLabelLoaded.lua index 186e78aa152..c1b6ab678ba 100644 --- a/src/contentproviderutils/src/Client/ImageLabelLoaded.lua +++ b/src/contentproviderutils/src/Client/ImageLabelLoaded.lua @@ -63,7 +63,6 @@ end function ImageLabelLoaded.PromiseLoaded(self: ImageLabelLoaded, timeout: number?): Promise.Promise<()> assert(type(timeout) == "number" or timeout == nil, "Bad timeout") - local originalTimeout = timeout timeout = timeout or self._defaultTimeout if self._isLoaded.Value then @@ -81,19 +80,17 @@ function ImageLabelLoaded.PromiseLoaded(self: ImageLabelLoaded, timeout: number? end end)) - maid:GiveTask(self.ImageChanged:Connect(function(isVisible) - if not isVisible then - promise:Reject() - end + maid:GiveTask(self.ImageChanged:Connect(function() + promise:Reject("[ImageLabelLoaded] - The image label changed before the image loaded") end)) if timeout then - maid:GiveTask(task.delay(timeout, function() - if originalTimeout then - promise:Reject("[ImageLabelLoaded] - Failed to load image after default timeout time") - else - promise:Reject() - end + local timeoutSeconds: number = timeout + + maid:GiveTask(task.delay(timeoutSeconds, function() + promise:Reject( + string.format("[ImageLabelLoaded] - Failed to load image after %0.2f seconds", timeoutSeconds) + ) end)) end