Skip to content

Instantly share code, notes, and snippets.

@towry
Last active August 29, 2015 14:16
Show Gist options
  • Save towry/d01ad9572e1b26fc1821 to your computer and use it in GitHub Desktop.
Save towry/d01ad9572e1b26fc1821 to your computer and use it in GitHub Desktop.
var b = new Promise(function (resolve, reject) {
setTimeout(function(){
reject(new Error("haha"));})
});
b.then(function(v){
console.log(v); return 3;
}, function(e) {
console.log("error: " + e);
}).then(function(v){
console.log("2: " + v);
}, function(e) {
console.log("error 2: " + e);
});
// output
Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
VM565:2 error: Error: haha
VM565:2 2: undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment