dowjones/gulp-bundle-assets

How to catch watch stream errors?

Opened this issue · 1 comments

Forgive me if this is a noob question, I'm a little new when it comes to Gulp. I'm wondering if it's possible to catch errors that happen during a watch. I'm able to do this successfully like this:

gulp.src(config.src)
    .pipe(bundle())
    .on('error', handleErrors)
    ...

However, I'm not quite sure how to do it here:

bundle.watch({
    configPath: path.join(__dirname, '../bundle.config.js'),
    dest: path.join(__dirname, '../../public/assets')
});

Unfortunately that's not currently possible. An api enhancement would be necessary to bundle.watch to add an onError handler, similar to the change proposed in this issue.

I accept PRs, otherwise I'll try to get to it when I have time.