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,
|
message: e.message,
|
||||||
filename: env.filename,
|
filename: env.filename,
|
||||||
index: e.index,
|
index: e.index,
|
||||||
line: line + 1,
|
line: typeof(line) === 'number' ? line + 1 : null,
|
||||||
callLine: e.call && (getLine(e.call) + 1),
|
callLine: e.call && (getLine(e.call) + 1),
|
||||||
callExtract: lines[getLine(e.call) - 1],
|
callExtract: lines[getLine(e.call)],
|
||||||
stack: e.stack,
|
stack: e.stack,
|
||||||
column: column,
|
column: column,
|
||||||
extract: [
|
extract: [
|
||||||
@ -330,7 +330,7 @@ less.Parser = function Parser(env) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLine(index) {
|
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);
|
})(root.toCSS);
|
||||||
|
@ -19,7 +19,7 @@ tree.mixin.Call.prototype = {
|
|||||||
rules, mixins[m].eval(this.arguments, env).rules);
|
rules, mixins[m].eval(this.arguments, env).rules);
|
||||||
match = true;
|
match = true;
|
||||||
} catch (e) {
|
} 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