-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling source stream errors #67
Comments
See the example at http://highlandjs.org/#errors As far as I can tell, in the node callback style your function should either |
I'm not using any node style callbacks. I also saw the source there, but calling .errors does nothing. The source stream emits the error but highland is not capturing it, so it just bubbles all the way up. One way to do it is to use a generator: var stream = _(function (push, next){
db.cypher(query, params)
.on('error', function (error){
push(error);
})
.on('data', function (result){
push(null, result);
next();
})
.on('end', function(){
push(null, $.nil)
})
});
stream.errors(handler) // works But it seems like I should be able to just wrap it and get the same effect: _(db.cypher(query,parms)).errors(handler) But it doesn't work. |
@brian-gates I think you're right, errors should probably get passed through the highland stream by default when you wrap it. +1 if you want to make a test case and pull request ;) |
+1 -- also in same boat with handling errors. It's late so I'll add an example later. |
I think every time you pipe an arbitrary stream to a highland stream you need to handle the error events as well, but I'm not sure how (simply re-emit?). I see 2 places for the moment, one in |
I'm having a look at this. |
If I wrap a stream that emits an error, the error is uncaught.
This is the stream I'm wrapping: https://github.com/brian-gates/cypher-stream/blob/master/index.js#L36
My syntax is this: _(source).errors(fn). I would expect the errors to be caught, but they are not.
Any help is appreciated.
The text was updated successfully, but these errors were encountered: