Use the keyword return,
your code can be simplified as:
PromiseA().then(function(){
return PromiseB();
}).catch(function (e) {
})
Edit:
Not sure if this is the right way, but if you want to void a promise, and you only want to create a stream of errors, you can wrap your promise in a custom promise that never resolves, but throws an error (if that happens):
PromiseA().then(function(){
var myPromise = PromiseB().then...;
return new Promise(function(resolve, reject){
myPromise.catch(reject)
})
}).catch(function (e) {
})
source
share