New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-prettyerror

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-prettyerror - npm Package Compare versions

Comparing version

to
1.1.0

4

CHANGES.md

@@ -0,1 +1,5 @@

### 1.1.0 ###
* Changed: Added default value to error message and plugin to avoid errors
* Bugfix: In some cases (e.g. gulp-less) the `Error.codeFrame` object is not exposed and caused a fatal error - thanks to [haqqi on GitHub](https://github.com/AndiDittrich/gulp-prettyerror/pull/3)
### 1.0.2 ###

@@ -2,0 +6,0 @@ * Bugfix: removed dead code

28

gulp-prettyerror.js
var _gutil = require('gulp-util');
var _gplumber = require('gulp-plumber');
// Main Function
var PrettyError = (function(customErrorFormat){

@@ -17,10 +18,20 @@

return _gplumber(function(error){
// add indentation
var msg = error.codeFrame.replace(/\n/g, '\n ');
// extract values and apply defaults
var plugin = error.plugin || 'unknown';
var rawMessage = error.message || 'unknown error';
var codeFrame = error.codeFrame || null;
_gutil.log('|- ' + _gutil.colors.bgRed.bold('Build Error in ' + error.plugin));
_gutil.log('|- ' + _gutil.colors.bgRed.bold(error.message));
_gutil.log('|- ' + _gutil.colors.bgRed('>>>'));
_gutil.log('|\n ' + msg + '\n |');
_gutil.log('|- ' + _gutil.colors.bgRed('<<<'));
// log the error message
_gutil.log('|- ' + _gutil.colors.bgRed.bold('Build Error in ' + plugin));
_gutil.log('|- ' + _gutil.colors.bgRed.bold(rawMessage));
// make sure there is codeFrame in the error object
if (codeFrame){
// add indentation
var msg = codeFrame.replace(/\n/g, '\n ');
_gutil.log('|- ' + _gutil.colors.bgRed('>>>'));
_gutil.log('|\n ' + msg + '\n |');
_gutil.log('|- ' + _gutil.colors.bgRed('<<<'));
}
});

@@ -30,2 +41,3 @@ }

module.exports = PrettyError;
// Expose the Main Function
module.exports = PrettyError;
{
"name": "gulp-prettyerror",
"version": "1.0.2",
"version": "1.1.0",
"description": "Display Errors in a pretty way, without breaking watch tasks",

@@ -5,0 +5,0 @@ "keywords": [