As we have seen, promises offer a richer error handling mechanism in asynchronous programming. Although the Promises/A+ spec tackles only one method, that is
.then(onFulfilled, onRejected), and does not provide any other, the specifications of
.then() lay the foundation for promise interoperability and, hence, extend the promise features, including error handling.
catch() method, which is implemented on top of the elementary
then() function. Anyone can author a
catch() method and include it in their scripts by extending the promise object as per the following ...