This is an investigation into how interconnected streams are handling emitted errors.
We want to test if/whether errors are propagated in any direction.
input.pipe(middle).pipe(output)
We also add error handlers on input/middle/output to avoid "uncaught" error event abort.
The error is not propagated in any direction. If we didn't have the error handler on the input, we wouldn't even know it happened.
input middle output notes
----- ------ ------ -----
1 pipe
2 pipe
3 resume
4 resume
5 data
6 data
7 _write <61 62>
8 error
9 input.on('error','Stop right there, mr!')
An error in the middle only causes the middle to unpipe, nothing more. Again we can only detect it by having an error handler on the stream causing the error. The input does stop pumping in more data.
input middle output notes
----- ------ ------ -----
1 pipe
2 pipe
3 resume
4 resume
5 data
6 data
7 _write <61 62>
8 data
9 error
10 unpipe
11 middle.on('error','We got a problem...')
12 readable
Errors in the output does not propagate either. The input keeps pushing data until the middle highWaterMark
is filled up at which point the input pauses.
input middle output notes
----- ------ ------ -----
1 pipe
2 pipe
3 resume
4 resume
5 data
6 data
7 _write <61 62>
8 data
9 data
10 _write <20 7a>
11 error
12 unpipe
13 output.on('error','Uh oh')
14 data
15 readable
16 data
17 data
18 data
19 data
20 data
21 data
22 data
23 data
24 data
25 pause
26 readable