Looking for a way to not exit on async.parallel on error.
See original GitHub issueMajority 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:
- Created 9 years ago
- Comments:18
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing this in favor of #942 . There’s also the PR: #1012
+1