Browse Source

unhandled-rejection-fix

session-estimator
David Mark Clements 4 years ago
committed by Mathias Buus
parent
commit
093cfd5bd8
  1. 2
      lib/race.js

2
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]

Loading…
Cancel
Save