simple-dark-mode-for-wp-das.../gulp/helpers/handle-errors.js
Roni Laukkarinen 8228136abc Release 1.0.0
2021-12-16 23:12:31 +02:00

30 lines
668 B
JavaScript

// Better CSS error reporting
const notify = require('gulp-notify');
// General error handling
const handleError = function () {
return function (err) {
if (typeof err !== 'undefined') {
var notifyMessage = '';
if (err.plugin === 'gulp-dart-sass') {
// Message in notification
notifyMessage = err.relativePath + '\n' + err.line + ':' + err.column;
}
if (err.plugin == 'gulp-stylelint') {
notifyMessage = 'CSS linter found errors.';
}
notify({
title: 'Gulp task failed — see console',
message: notifyMessage
}).write(err);
}
};
};
module.exports = {
handleError
};