diff --git a/lib/less/parser.js b/lib/less/parser.js index c32852d..5ddc217 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -311,9 +311,9 @@ less.Parser = function Parser(env) { message: e.message, filename: env.filename, index: e.index, - line: line + 1, + line: typeof(line) === 'number' ? line + 1 : null, callLine: e.call && (getLine(e.call) + 1), - callExtract: lines[getLine(e.call) - 1], + callExtract: lines[getLine(e.call)], stack: e.stack, column: column, extract: [ @@ -330,7 +330,7 @@ less.Parser = function Parser(env) { } function getLine(index) { - return (input.slice(0, index).match(/\n/g) || "").length; + return index ? (input.slice(0, index).match(/\n/g) || "").length : null; } }; })(root.toCSS); diff --git a/lib/less/tree/mixin.js b/lib/less/tree/mixin.js index c34a288..175f53f 100644 --- a/lib/less/tree/mixin.js +++ b/lib/less/tree/mixin.js @@ -19,7 +19,7 @@ tree.mixin.Call.prototype = { rules, mixins[m].eval(this.arguments, env).rules); match = true; } catch (e) { - throw { message: e.message, index: e.index, call: this.index }; + throw { message: e.message, index: e.index, stack: e.stack, call: this.index }; } } }