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
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
### Fixed
|
||||||
|
- Fix unhandled rejection warning appearing when using :awaitStatus
|
||||||
|
|
||||||
## [4.0.0-rc.2] - 2022-01-02
|
## [4.0.0-rc.2] - 2022-01-02
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix bug where Promise.fold does not return correct value if there is an unresolved Promise in the passed list (#77)
|
- Fix bug where Promise.fold does not return correct value if there is an unresolved Promise in the passed list (#77)
|
||||||
|
|
12
lib/init.lua
12
lib/init.lua
|
@ -1616,9 +1616,15 @@ function Promise.prototype:awaitStatus()
|
||||||
if self._status == Promise.Status.Started then
|
if self._status == Promise.Status.Started then
|
||||||
local thread = coroutine.running()
|
local thread = coroutine.running()
|
||||||
|
|
||||||
self:finally(function()
|
self
|
||||||
task.spawn(thread)
|
:finally(function()
|
||||||
end)
|
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()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue