zserge / lua-promises

A+ promises in Lua
https://zserge.com/lua-promises/
MIT License
222 stars 35 forks source link

deferred.all() returns nil when at least one reject()ion occurs #10

Closed Tarnyko closed 4 years ago

Tarnyko commented 4 years ago

Hi, the documentation (in README.md, "Waiting for a group of promises") states that when using deferred.all() :

end, function(results)
    -- handle errors here (all requests are finished and there has been
    -- at least one error)
end)

in case of one or more reject()ions, there should be a "results" variable containing an array of all sub-promises results.

However, it seems this variable is always nil. Thus, in case at least one promise sucessfully resolv()ed, its result cannot be processed.

Please consider a reproducible testcase, which when run with LuaJIT 2.1.0beta3 returns:

    Rejected at least one promise!
    Returned KO result was:
nil not a table