Last active
April 9, 2017 18:27
-
-
Save LoyEgor/964b94834fd7f8d8167e0774a5ca59b0 to your computer and use it in GitHub Desktop.
custom popup error report
This file contains 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
//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