diff --git a/lib/race.js b/lib/race.js index e586e3c..277b54f 100644 --- a/lib/race.js +++ b/lib/race.js @@ -1,6 +1,8 @@ module.exports = async function race (p, min = 1, max = p.length) { let errors = 0 const results = [] + // avoid unhandled rejections after early return/throw + for (const promise of p) promise.catch(() => {}) for (let i = 0; i < p.length; i++) { try { const res = await p[i]