fix error messages with no index

This commit is contained in:
cloudhead 2010-07-07 11:58:26 +02:00
parent 38272c7f85
commit 2afcdd7860
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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 };
}
}
}