Am developing backend of an app using nodejs+express and using RSVP for promises.
Problem : whenever there is an error or exception in one of the functions that is unexpected the execution is stuck. Is there any way i can find which one of the functions have the error.
The code looks like this :
function checkifvalid_call() {
return new RSVP.Promise(function(fulfil, reject) {
common.checkifvalid(test, function(isValid) {
if (isValid === false) {
logger.fatal("Not valid test....sending invalid result")
res.send({
"Error": "Invalid test"
});
}
});
});
}
function secondtest_call() {
return new RSVP.Promise(function(fulfil, reject) {
common.secondtest(test, function(isValid) {
if (isValid === false) {
logger.fatal("Not valid second test....sending invalid result")
res.send({
"Error": "Invalid second test"
});
}
});
});
}
RSVP.allSettled([checkifvalid_call(), secondtest_call()]).then(function(ret_array) {
console.log("Calls finished");
logger.debug("sending result..............")
res.send("success);
}).catch(function(reason) {
logger.debug("Exception encountered : " + reason);
}).finally(function() {
logger.debug("All done finally")
});
RSVP.on('error', function(reason) {
console.assert(false, reason);
});
Thank you.