diff --git a/lib/less/index.js b/lib/less/index.js index 4b5d46d7..cac29679 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -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')) } } };