Skip to content

Instantly share code, notes, and snippets.

@domenic domenic/gist:6143202 forked from gkatsev/gist:6143193
Last active Dec 20, 2015

Embed
What would you like to do?
function foo(id) {
return bar(id).then(function (obj) {
if (!obj) {
throw new Error('no obj');
}
return obj; // pass it through
}).then(
function (obj) {
console.log('we got here, and have an obj; passing it through');
return obj;
},
function (err) {
console.log('we got an error; re-throwing it');
throw err;
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.