Why do I need both? What is the difference
Between
.then(doWork, errorHandler)
… and …
.then(doWork)
.catch(errorHandler)
Is it a matter of convenience and both will catch errors? Do I need to use both or only one? On which use cases?
Why do I need both? What is the difference
Between
.then(doWork, errorHandler)
… and …
.then(doWork)
.catch(errorHandler)
Is it a matter of convenience and both will catch errors? Do I need to use both or only one? On which use cases?
In the first code snippet, if the success handler throws an exception or rejects a promise, execution will not go into the error handler since the promise was already resolved at this level.
With catch, you can always see an unhandled error from the previous success handler.