-
-
Save Lukas238/910f660f16cf13a7c7a2 to your computer and use it in GitHub Desktop.
Proper Error Handling in gulp.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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