On the other hand, when using Readable from node:stream (instead of streamx), an uncaughtException is thrown. This is the correct behavior, else the error would be silently ignored, despite not being properly handled by users.
Additional information
node:stream.pipe() has some code to handle that specific situation.
The following does not raise an
uncaughtException
.On the other hand, when using
Readable
fromnode:stream
(instead ofstreamx
), anuncaughtException
is thrown. This is the correct behavior, else the error would be silently ignored, despite not being properly handled by users.Additional information
node:stream
.pipe()
has some code to handle that specific situation.https://github.com/nodejs/node/blob/8aac7da7d66fc0b1426d8bf1e7b3e7b7208885bd/lib/internal/streams/readable.js#L1020-L1028
This logic is absent from
streamx
.Related bugs
Gulp (which uses
streamx
) currently relies on anuncaughtException
being thrown. This is because it usesasync-done
, which usesnode:domain
, which intercepts uncaught exceptions.This leads to simple Gulp pipelines not handling errors properly, as described in https://github.com/gulpjs/gulp/issues/2812
Solution
PR opened at #95.