Skip to content

How to catch errors without stopping gulp.watch? #71

@dashed

Description

@dashed

I'm exploring gulp as a replacement for gruntjs.

Here is my gulpfile.js.

I'm using gulp to watch and compile coffeescript files (with gulp-coffee). In addition, I'm using gulp.watch to only compile individual files instead of entire targeted globbed paths.

My issue is that if I purposely put incorrect coffeescript syntax, gulp exits:

events.js:72
        throw er; // Unhandled 'error' event
< gulp-coffee error here >
< rest of stack trace >

How should I catch the error without having it stop gulp.watch? And perhaps re-initiate the default task?

I'm not familiar with streaming in node. I tried try-catch and checked if any callbacks are catching the error to no avail. Appreciate if someone point me in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions