[Vuejs]-Handle errors with parallel async requests

0👍

For the rest of the tasks to continue processing even if any of the other fails, you need to push the tasks to an array where each task is wrapped in async.reflect and set the array of tasks as first argument to async.parallel.

For example:

async.parallel([
 async.reflect((callback) => {
   return callback(null, "one");
 }),
 async.reflect((callback) => {
   return callback("error");
 }),
 // another tasks
], function(error, results) {
  if(error)
    return cb(error)

  // results[0].value ->> "one"
  // results[1].error ->> "error"

  return cb(results)
})

Source: Async Documentation utils >> reflect

Leave a comment