throw error in promise chain code example Example: handle error in promise chain promise.then(successHandler).catch(errorHandler);