mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 15:50:01 +00:00
parent
e23601b924
commit
cab1c5ec8b
2 changed files with 13 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## Unreleased
|
||||
### Fixed
|
||||
- Fix unhandled rejection warning appearing when using :awaitStatus
|
||||
|
||||
## [4.0.0-rc.2] - 2022-01-02
|
||||
### Fixed
|
||||
- Fix bug where Promise.fold does not return correct value if there is an unresolved Promise in the passed list (#77)
|
||||
|
|
|
@ -1616,9 +1616,15 @@ function Promise.prototype:awaitStatus()
|
|||
if self._status == Promise.Status.Started then
|
||||
local thread = coroutine.running()
|
||||
|
||||
self:finally(function()
|
||||
self
|
||||
:finally(function()
|
||||
task.spawn(thread)
|
||||
end)
|
||||
-- The finally promise can propagate rejections, so we attach a catch handler to prevent the unhandled
|
||||
-- rejection warning from appearing
|
||||
:catch(
|
||||
function() end
|
||||
)
|
||||
|
||||
coroutine.yield()
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue