forked from colinmorris/atypicality
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport-error.js
More file actions
28 lines (19 loc) · 732 Bytes
/
Copy pathreport-error.js
File metadata and controls
28 lines (19 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const notify = require('gulp-notify')
const gutil = require('gulp-util')
module.exports = function(error) {
const lineNumber = (error.lineNumber) ? 'LINE ' + error.lineNumber + ' -- ' : '';
notify({
title: 'Task failed [' + error.plugin + ']',
message: lineNumber + 'See terminal.',
sound: 'Sosumi'
}).write(error);
gutil.beep();
let report = '';
let chalk = gutil.colors.white.bgRed;
report += chalk('TASK:') + ' [' + error.plugin + ']\n';
report += chalk('PROB:') + ' ' + error.message + '\n';
if (error.lineNumber) { report += chalk('LINE:') + ' ' + error.lineNumber + '\n'; }
if (error.fileName) { report += chalk('FILE:') + ' ' + error.fileName + '\n'; }
console.error(report);
this.emit('end');
}