mirror of
https://github.com/less/less.js.git
synced 2026-02-03 03:25:11 -05:00
fix error output on unexpected errors
This commit is contained in:
@@ -43,6 +43,8 @@ var less = {
|
||||
|
||||
if (options.silent) { return }
|
||||
|
||||
if (ctx.stack) { return sys.error(stylize(ctx.stack, 'red')) }
|
||||
|
||||
if (!ctx.hasOwnProperty('index')) {
|
||||
return sys.error(ctx.stack || ctx.message);
|
||||
}
|
||||
@@ -51,9 +53,11 @@ var less = {
|
||||
error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
|
||||
}
|
||||
|
||||
error.push(ctx.line + ' ' + extract[1].slice(0, ctx.column)
|
||||
+ stylize(stylize(extract[1][ctx.column], 'bold')
|
||||
+ extract[1].slice(ctx.column + 1), 'yellow'));
|
||||
if (extract[1]) {
|
||||
error.push(ctx.line + ' ' + extract[1].slice(0, ctx.column)
|
||||
+ stylize(stylize(extract[1][ctx.column], 'bold')
|
||||
+ extract[1].slice(ctx.column + 1), 'yellow'));
|
||||
}
|
||||
|
||||
if (typeof(extract[2]) === 'string') {
|
||||
error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
|
||||
@@ -70,7 +74,6 @@ var less = {
|
||||
sys.error(stylize('from ', 'red') + (ctx.filename || ''));
|
||||
sys.error(stylize(ctx.callLine, 'grey') + ' ' + ctx.callExtract);
|
||||
}
|
||||
if (ctx.stack) { sys.error(stylize(ctx.stack, 'red')) }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user