I have the following application:
var async = require('async');
function foo() {
async.series({
functionName1: function (callback) {
promiseResolve()
.then(result => {
callback(null, result);
}).catch(error => {
console.log('problema na funcao 1');
callback(error, null);
});
},
functionName2: function (callback) {
promiseReject()
.then(result => {
callback(null, result);
}).catch(error => {
console.log('problema na funcao 2');
callback(error, null);
});
}
}, function (error, results) {
if (error) {
console.log(error);
}
});
}
function promiseResolve() {
// return promise resolve();
}
function promiseReject() {
// ocorre um erro sintatico
}
Whereas within async.series
I have two functions, functionName1
, and functionName2
. And in functionName1
I call another function out called promiseResolve()
which will return a resolved resolve, and the functionName2
function will call the outside function named promiseReject
which will return any syntactic error.
The problem and the following, console.log
will display this message: problema na funcao 1
, but the reject was performed in the second function, so it would have to show problema na funcao 2
. I can not imagine what might be the reason, maybe you guys being more experienced can tell me.