Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created February 27, 2017 11:12
Show Gist options
  • Save gskachkov/8f4c4b82b359ca089ac0829a4eecfa9c to your computer and use it in GitHub Desktop.
Save gskachkov/8f4c4b82b359ca089ac0829a4eecfa9c to your computer and use it in GitHub Desktop.
Example of Reject Promise
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