When using pipe(), the error events are not propagated automatically through the pipeline:
We will catch only the errors coming from stream2.
If we want to catch any error generated from stream1 , we have to attach another error listener directly to it:
pipeline() helper function
You can use the pipeline() from the core stream package.
This pipes every stream passed in the arguments list to the next one. For each stream, it will also register a proper error and close listeners.