-
-
Save domenic/6143202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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