Skip to content

Instantly share code, notes, and snippets.

@iampava
Created January 23, 2017 21:53
Show Gist options
  • Save iampava/6fb8cf9ece6ab510387b1f193ba10963 to your computer and use it in GitHub Desktop.
Save iampava/6fb8cf9ece6ab510387b1f193ba10963 to your computer and use it in GitHub Desktop.
Skydiving through the Promise Land - promise error
function takeOff(resolve, reject) {
setTimeout(function () {
console.log("Whooopsy! Wheater is bad!");
reject();
}, 5000);
}
function callFriendAndTalkVeryExcitedlyAboutYourPrototype() {
console.log("Hey friend, you will not believe what my mind stumbled upon...");
}
function getIntoCarAndDriveToAirportASAP() {
console.log("Don't cry, I'm coming to you with ice-cream!");
}
var promise = new Promise(takeOff);
promise.then(callFriendAndTalkVeryExcitedlyAboutYourPrototype, getIntoCarAndDriveToAirportASAP);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment