question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Looking for a way to not exit on async.parallel on error.

See original GitHub issue

Majority of my most recent use-cases involve async functions that aren’t dependent on each other, and so when some async function breaks up top, the rest of my code doesn’t execute. Wondering if there’s a simple way to do something like this without being so obtrusive to the library / so much overhead. In this case I’d like to return false on error, so I’m building an object with every property intact, if something fails everything is else is still there, and false takes the broken async functions place.

var noError = function(func) {
  return function(callback) {
    func(function(err, value) {
      if (err) return callback(null, false);
      return callback(null, value);
    });
  }
}

var parallelNoError = function(functions, callback) {
  var newFunctions = {};
  for (var func in functions) {
    newFunctions[func] = noError(functions[func]);
  }
  return async.parallel(newFunctions, callback);
}

@aearly Would love your thoughts on this one too.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
aearlycommented, Feb 16, 2016

Closing this in favor of #942 . There’s also the PR: #1012

0reactions
jvillanticommented, Feb 15, 2016

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to end on first async parallel task completion in Node?
Parallel Race. You can get async to initiate the final callback by returning an error that evaluates as true but isn't actually an...
Read more >
Use Promise.all to Stop Async/Await from Blocking ...
When writing asynchronous code, async/await is a powerful tool — but it comes with risks! Learn how to avoid code slowdowns in this...
Read more >
How to avoid uncaught async errors in Javascript
Another rather common source of uncaught exceptions is to run things in parallel by separating the Promise from the await . Since only...
Read more >
async - Documentation - GitHub Pages
Applies the function iteratee to each item in coll , in parallel. The iteratee is called with an item from the list, and...
Read more >
Task asynchronous programming model
The async and await keywords don't cause additional threads to be created. Async methods don't require multithreading because an async method ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found