Skip to content

Instantly share code, notes, and snippets.

@LoyEgor
Last active April 9, 2017 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LoyEgor/964b94834fd7f8d8167e0774a5ca59b0 to your computer and use it in GitHub Desktop.
Save LoyEgor/964b94834fd7f8d8167e0774a5ca59b0 to your computer and use it in GitHub Desktop.
custom popup error report
//install
//npm i gulp-if gulp-notify gulp-plumber gulp-util
var gulpif = require('gulp-if');
var notify = require('gulp-notify');
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
//report error
var reportError = function(error) {
var report = '\n';
var chalk = gutil.colors.white.bgRed;
if (error.plugin) {
report += chalk('PLUGIN:') + ' [' + error.plugin + ']\n';
}
if (error.message) {
report += chalk('ERROR:\040') + ' ' + error.message + '\n';
}
console.error(report);
if (error.line && error.column) {
var notifyMessage = 'LINE ' + error.line + ':' + error.column + ' -- ';
} else {
var notifyMessage = '';
}
notify({
title: 'FAIL: ' + error.plugin,
message: notifyMessage + 'See console.',
sound: 'Beep'
}).write(error);
gutil.beep();
this.emit('end');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment