Skip to content

Instantly share code, notes, and snippets.

@Lukas238
Created August 5, 2015 23:10
Show Gist options
  • Save Lukas238/910f660f16cf13a7c7a2 to your computer and use it in GitHub Desktop.
Save Lukas238/910f660f16cf13a7c7a2 to your computer and use it in GitHub Desktop.
Proper Error Handling in gulp.js
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
var gulp_src = gulp.src;
gulp.src = function() {
return gulp_src.apply(gulp, arguments)
.pipe(plumber(function(error) {
// Output an error message
gutil.log(gutil.colors.red('Error (' + error.plugin + '): ' + error.message));
// emit the end event, to properly end the task
this.emit('end');
})
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment