Skip to content

Instantly share code, notes, and snippets.

@liorsion
Created March 7, 2014 23:19
Show Gist options
  • Select an option

  • Save liorsion/9422215 to your computer and use it in GitHub Desktop.

Select an option

Save liorsion/9422215 to your computer and use it in GitHub Desktop.
var Promise = require("es6-promise").Promise;
function test() {
return new Promise(function (resolve, reject) {
reject(true);
});
}
function test2() {
return test()
.then(function() {
return "yes!";
}).catch(function() {
return("no!");
})
}
test2()
.then(function(result) {
console.log(result);
})
.catch(function() {
console.log("Exception");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment