Skip to content

Instantly share code, notes, and snippets.

@nevyn
Created October 22, 2015 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevyn/c9b7de08d68670dad750 to your computer and use it in GitHub Desktop.
Save nevyn/c9b7de08d68670dad750 to your computer and use it in GitHub Desktop.
#!env NODE_PATH=/usr/local/lib/node_modules node --harmony
var Promise = require("bluebird")
var b = Promise.method(function() {
throw new Error("omg");
return "b";
})
var a = Promise.coroutine(function *() {
var ret = yield b();
return ret;
});
a().then(function(v) {
console.log("Value", v);
}).catch(function(e) {
console.log("Error", e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment