In Documentation I can't find the way to handle error in async series method. How can i learn async js properly, usually github wiki are the below average for people who are not affiliated with it in terms of usefulness.
Here is my code:
function async1(cb,err) {
setTimeout(function () {
console.log(1);
cb();
}, 1000);
}
function async2(cb,err) {
setTimeout(function () {
// console.log(2);
throw new Error;
cb();
}, 1000);
}
function async3(cb,err) {
setTimeout(function () {
console.log(3);
cb();
}, 1000);
}
async.series([
async1,
async2,
async3
], function (err) {
console.log(err);
});
It just terminates and throw error.
I've few questions...
Am I handling error correctly, apparently not correctly, so what's wrong?
For Async to work does the function used in series does it have to have first parameter as callback?
If yes, then does it mean you can't use it with other libraries. Because they might not have callback as first parameter.