Skip to content

Instantly share code, notes, and snippets.

@laser
Created September 24, 2014 06:03
Show Gist options
  • Save laser/28dc20b8d1191e6683b0 to your computer and use it in GitHub Desktop.
Save laser/28dc20b8d1191e6683b0 to your computer and use it in GitHub Desktop.
error / stream composition
var streamA = Bacon.fromNodeCallback(client, 'get', 'foo');
var streamB = streamA.flatMap(function(foo) {
return Bacon.fromNodeCallback(client, 'post', 'bar', { data: foo });
});
streamB.onError(function(err) {
throw err; // error from either the GET or the POST
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment