-
-
Save pionize/af2ed646cee8a7bcc6eac50598696214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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