| 350 | } |
| 351 | |
| 352 | function errorConsole(e, rootHref) { |
| 353 | var template = '{line} {content}'; |
| 354 | var filename = e.filename || rootHref; |
| 355 | var errors = []; |
| 356 | var content = (e.type || "Syntax") + "Error: " + (e.message || 'There is an error in your .less file') + |
| 357 | " in " + filename + " "; |
| 358 | |
| 359 | var errorline = function (e, i, classname) { |
| 360 | if (e.extract[i] !== undefined) { |
| 361 | errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) |
| 362 | .replace(/\{class\}/, classname) |
| 363 | .replace(/\{content\}/, e.extract[i])); |
| 364 | } |
| 365 | }; |
| 366 | |
| 367 | if (e.extract) { |
| 368 | errorline(e, 0, ''); |
| 369 | errorline(e, 1, 'line'); |
| 370 | errorline(e, 2, ''); |
| 371 | content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':\n' + |
| 372 | errors.join('\n'); |
| 373 | } |
| 374 | if (e.stack && (e.extract || options.logLevel >= 4)) { |
| 375 | content += '\nStack Trace\n' + e.stack; |
| 376 | } |
| 377 | less.logger.error(content); |
| 378 | } |
| 379 | |
| 380 | function error(e, rootHref) { |
| 381 | if (!options.errorReporting || options.errorReporting === "html") { |