I am under the impression that these two things are not equivalent:
return somePromise()
.then()
.then()
.then()
.catch(function(e) { throw e; });
and
return somePromise()
.catch(function(e) { throw e; });
.then()
.catch(function(e) { throw e; });
.then()
.catch(function(e) { throw e; });
.then()
.catch(function(e) { throw e; });
The first snippet will only catch errors on the latest then (the other errors will be lost) whereas the second snippet will catch any error anywhere along the chain.
But I must be missing something because forcing the user to remember putting a catch after every promise defeats the purpose of promises.
Am I misunderstanding and placing a .catch()
last will catch any error along the chain?