I am working On NodeJS
Project , I used Promise In my code
to chain some methods , I needed to abort in one of the 'thens' chain
findEmployeeByCW('11111', "18-09-2016").
then(function () {
return findEmployeeByCWE('111111', "18-09-2016", '111111')
}, function () {
console.log('createEmployeeLoginBy')
createEmployeeLoginBy('111111', "18-09-2016", '111111').
then(function (log) {
SaveEmployeeLogToDb(log)
// ***************
// ^_^ I need to exit here ....
})
})
.then(function (log) {
return updateLoginTimeTo(log, '08-8668', '230993334')
}, function () {
return createNewEmployeeLog('224314', "18-09-2016",
'230993334', '08-99')
})
.then(SaveEmployeeLogToDb).then(DisplayLog).catch(function (e) {
console.log(e);
})