I am making myself a library which retries failed promise "chain-parts" - I collect methods to be called and queue next phase only after previous succeeded.
Conceptually rounded up - my problems are more fundamental. This is where I arrived with debugging:
this.runningPromise
.then(function() {
return Promise.reject();
})
//;
//this.runningPromise
.then(this.promiseResolver.bind(this))
.catch(this.promiseRejector.bind(this))
;
Works, promiseRejector
kicks in. When I uncomment out the two lines, works not. promiseResolver
gets called.
Can't find anywhere anything. Nodejs 6.10.3 with browserify on Windows, Chrome.
If you uncomment two rows means you are calling this.runningPromise
twice and each time it has its own callbacks.
If you keep the rows commented then it will act as a promise (and associated callbacks)
Better you should assign promise to a variable and then you can use it multiple times.
let newPromise = this.runningPromise
.then(function() {
return Promise.reject();
});
newPromise
.then(this.promiseResolver.bind(this))
.catch(this.promiseRejector.bind(this));
With above code you can use newPromise
multiple times.