-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Hi,
Current behavior of settleAll function is that if some promise throws an error, it is removed from the results array and added to errors array. This way the order of promises is broken and additionally, it's hard to guess, from which promise the errors comes. E.g.
/* As an example, secondPromise() throws an error */
const {
results: [
firstPromiseResult,
secondPromiseResult, // it contains thirdPromiseResult
thirdPromiseResult, // it is undefined
],
errors, // it contains array of single error of the second promise
} = await settleAll([
firstPromise(),
secondPromise(),
thirdPromise(),
]);To my mind, it would be much more intuitive if the order of resolved promises and errors preserved:
/* As an example, secondPromise() throws an error */
const {
results: [
firstPromiseResult,
secondPromiseResult, // it contains null/undefined
thirdPromiseResult, // it contains thirdPromiseResult
],
errors, // it contains [null, secondPromiseError, null]
} = await settleAll([
firstPromise(),
secondPromise(),
thirdPromise(),
]);Metadata
Metadata
Assignees
Labels
No labels