Skip to content

Instantly share code, notes, and snippets.

@nfroidure
Forked from floatdrop/gist:8266618
Created January 5, 2014 10:35
Show Gist options
  • Save nfroidure/8266634 to your computer and use it in GitHub Desktop.
Save nfroidure/8266634 to your computer and use it in GitHub Desktop.
gulp.src(...)
.pipe(gutil.forwardErrors(pluginA()))
.pipe(gutil.forwardErrors(pluginB()))
.pipe(gutil.forwardErrors(pluginC()))
.on('error', function () {
throw new Error("Do not send to production!");
});
@nfroidure
Copy link
Author

gulp.src(..., {forwardErrors: true})
    .pipe(pluginA())
    .pipe(pluginB())
    .pipe(pluginC())
        .on('error', function () {
          throw new Error("Do not send to production!");  
        });

@dashed
Copy link

dashed commented Jan 5, 2014

Also, what if we have something like this:

gulp.src(..., { onErrorFunc: console.error})
    .pipe(pluginA())
    .pipe(pluginB())
    .pipe(pluginC())
        .on('error', function () {
          throw new Error("Do not send to production!");  
        });

onErrorFunc would be shorthand for .on('error', console.error) that gets hooked to all streams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment