Files
less.js/lib/less/less-error.js
Forbes Lindesay 07f9ba258e Move chunker and LessError into separate files
This begins the process of cleaning up parser.js
[see #1902]
2014-05-20 16:12:18 +01:00

28 lines
834 B
JavaScript

module.exports = LessError;
function LessError(parser, e, env) {
var input = parser.getInput(e, env),
loc = parser.getLocation(e.index, input),
line = loc.line,
col = loc.column,
callLine = e.call && parser.getLocation(e.call, input).line,
lines = input.split('\n');
this.type = e.type || 'Syntax';
this.message = e.message;
this.filename = e.filename || env.currentFileInfo.filename;
this.index = e.index;
this.line = typeof(line) === 'number' ? line + 1 : null;
this.callLine = callLine + 1;
this.callExtract = lines[callLine];
this.stack = e.stack;
this.column = col;
this.extract = [
lines[line - 1],
lines[line],
lines[line + 1]
];
}
LessError.prototype = new Error();
LessError.prototype.constructor = LessError;