Unhandled stream error terminates Node process in gulp.src pipeline
0 reputation · 30 Jul 2023, 14:47 UTC
Goal
Prevent a Gulp 4 pipeline from terminating the Node process when an upstream transform stream emits an error, using one error handler on the pipeline.
Constraints
Stream errors move through the vinyl file system asynchronously, so try/catch cannot capture them. Plugins may swallow or reformat error events, and behavior depends on the plugin and gulp version.
Does an error listener attached only to gulp.dest() protect every upstream stream in the chain, or must each stream handle its own error event? Does the result differ when the pipeline is wrapped in gulp.series()?