Use pcall() on Promise.is when looking for the .andThen function

Some tables might have strict metatables that error if a non-existant
member is indexed, causing the chain to fail.
This commit is contained in:
David Duque 2020-05-02 19:24:05 +01:00
parent 17becff40b
commit 4586cc5a90
No known key found for this signature in database
GPG key ID: 2F327738A3C0AE3A

View file

@ -471,7 +471,11 @@ function Promise.is(object)
return false
end
return type(object.andThen) == "function"
local ok, isPromise = pcall(function()
return type(object.andThen) == "function"
end)
return ok and isPromise
end
--[[