How to handle error?
steverandy opened this issue · comments
Steve Randy Tantra commented
I'm using this plugin with gulp-coffee
and gulp.watch
to do incremental build.
When there is an error thrown by coffee plugin, it seems to crash gulp.watch
.
I tried to use gulp-plumber
but didn't help.
What's the correct way of handling error?
stream = gulp.src bundles[filename]
.pipe plumber()
.pipe coffeeFilter
.pipe cache coffee()
.pipe coffeeFilter.restore()
.pipe concat filename
Jacob Gable commented
Can you put together an example of it crashing in a test repo that I can clone down and debug? Otherwise, I'll just waste a bunch of time setting up something wrong that doesn't match your environment.
Steve Randy Tantra commented
I got it fixed by emitting "end" event after the error event.
stream = gulp.src bundles[filename]
.pipe coffeeFilter
.pipe cache coffee()
.on "error", (err) ->
console.log err.toString()
@emit "end"
.pipe coffeeFilter.restore()
.pipe concat filename