Closed atraver closed 6 years ago
Thanks, yep I tested it and that is a bug. If one item of a Promise.All rejects, the whole thing should reject without triggering the unhandled exception handler or attempting to resolve any rejected promises. Same with Promise.Sequence.
I'm working on fixing it now so the fix will be in the next release.
Dude, you guys rock. I've converted so much of my old Coroutine/Update loop stuff to Promises since I found your project -- it mirrors most of what we do on the server side with node.js so it just makes a lot more sense. Looking forward to the next release!
Please spread the word and if anyone wants an introduction please point them at my web site.
http://www.what-could-possibly-go-wrong.com/promises-for-game-development/
I've fixed the issue and pushed a new release now. Let me know if it still happens with the latest version of the library.
I've got a weird situation where I'm getting an exception when my code rejects an asynchronous promise (
All
) inside a synchronous block (Sequence
). The code looks like this:The
ContinueLoading
method, which is the cause of the issue (although it seems as though it could also occur ifLoadAssets
throws an exception) looks like this:To test the issue, I'm explicitly
Reject
ing in anOnClick
handler (we're using Unity) inStorySequenceUI
. When I do this, the exception bubbles up properly, but I get a second exception as well:Is this because
Init
in the firstSequence
function has already rejected, butLoadAssets
is trying to resolve? To be clear, in my case, I'm explicitlyReject
ing inside a function called by theGameController.Instance.Init(response).Then(() => ContinueLoading())
block, butContentManager.Instance.LoadAssets
finishes after and resolves properly.Is this a case where something like
ThenRace
would be better suited? Maybe I'm totally misunderstanding what is/should be happening here when one of the promises in anAll
block rejects but the others resolve.