Skip to content

Promise.all propagates resolved values into the catch handler. #7

@hsjunnesson

Description

@hsjunnesson

For Promise.all(), when some promises are resolved, and some rejected, the catch handler receives all values.
This makes it really hard to tell which are errors and which aren't.

local Promise = require 'promise'

local promise1 = Promise.new()
local promise2 = Promise.new()

Promise.all(promise1, promise2)
:catch(function(error)
  print(error[1])
  print(error[2])
end)

promise1:resolve(123)
promise2:reject("GenericError")

Promise.update()

Outputs this:

123
GenericError

I would like to have:

nil
GenericError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions