Created
February 27, 2017 11:12
-
-
Save gskachkov/8f4c4b82b359ca089ac0829a4eecfa9c to your computer and use it in GitHub Desktop.
Example of Reject Promise
This file contains hidden or 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
var bar = new Promise(function (resolve) { | |
setTimeout(function () { reject('error'); }, 50); | |
}); | |
bar.then(function() {}, function (reject) { | |
console.log('reject:', reject); | |
}); // reject:error | |
bar.catch(function (reject) { | |
console.log('catch:', reject); | |
}); // catch:error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment