Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Propagate error events throughout the chain #8

Open
polotek opened this Issue · 0 comments

1 participant

@polotek
Owner

Once we have proc chain state, we can improve error handling. Essentially when an error occurs at a point in the chain, that error is propagated backwards in the chain until it hits an error handler, or it throws. Errors don't propagate forward, which allows you to set error handlers at various points in the chain and have things behave more or less as expected. Here's some more context from a discussion with @mikeal.

5:29 Marco Rogers
so, I'm assuming you think errors should propagate forward in the proc chain
like you should be able to set an error handler at the end
and catch everything

5:30 Mikeal Rogers
yeah

5:30 Marco Rogers
I can see how that's convenient, but it kinda sucks

5:30 Mikeal Rogers
that would make sense
is it?

5:30 Marco Rogers
how would you tell which thing failed?
and what if you wanted to handle parts of the chain separately?

5:31 Mikeal Rogers
p.createChild() -> self.on('error', child.emit.bind(child)
so, if you split the chain
both will get parent errors

5:32 Marco Rogers
when you say parent child, you mean earlier in the chain and later in the chain right?

5:32 Mikeal Rogers
but those child branches will only propagate themselves
hrm..........

5:33 Marco Rogers
you were confusing the shit out of me before with that

5:33 Mikeal Rogers
actually

5:33 Marco Rogers
if you blindly forward errors then they will fire at every level

5:33 Mikeal Rogers
maybe you want a child error to emit on the parent

5:33 Marco Rogers
have errs propagate backwards
maybe

5:33 Mikeal Rogers
but only propagate until there is a handler
we had a proposal for this in streams that seemed smart

5:34 Marco Rogers
yep, I remember it
too bad nobody writes this shit down 
we need a node core stenographer

5:34 Mikeal Rogers
haha

5:35 Marco Rogers
So the simple version was that when an error happened at any point in the pipe chain
it would break the pipe at that point
errors would flow backwards towards the readstream
but NOT forward
instead it would just call "end" on forward streams
so they know that the pipe is over, they don't need to know what happened

5:36 Mikeal Rogers
yeah
that's what i'm saying
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.