Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pionize

pionize/.js Secret

Created April 27, 2017 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pionize/af2ed646cee8a7bcc6eac50598696214 to your computer and use it in GitHub Desktop.
Save pionize/af2ed646cee8a7bcc6eac50598696214 to your computer and use it in GitHub Desktop.
//these two scripts are equivalent
somePromise().catch(function (err) {
// handle error
});
somePromise().then(null, function (err) {
// handle error
});
//these two scripts are not equivalent
somePromise().then(function () {
return someOtherPromise();
}).catch(function (err) {
// handle error
});
somePromise().then(function () {
return someOtherPromise();
}, function (err) {
// handle error
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment