fix error messages with no index
This commit is contained in:
parent
38272c7f85
commit
2afcdd7860
@ -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);
|
||||
|
@ -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 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user