Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = void 0;
|
---|
| 7 |
|
---|
| 8 | var _path = _interopRequireDefault(require("path"));
|
---|
| 9 |
|
---|
| 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 11 |
|
---|
| 12 | class LessError extends Error {
|
---|
| 13 | constructor(error) {
|
---|
| 14 | super();
|
---|
| 15 | this.message = ["\n", ...LessError.getFileExcerptIfPossible(error), error.message.charAt(0).toUpperCase() + error.message.slice(1), error.filename ? ` Error in ${_path.default.normalize(error.filename)} (line ${error.line}, column ${error.column})` : ""].join("\n");
|
---|
| 16 | this.hideStack = true;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | static getFileExcerptIfPossible(lessError) {
|
---|
| 20 | if (typeof lessError.extract === "undefined") {
|
---|
| 21 | return [];
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | const excerpt = lessError.extract.slice(0, 2);
|
---|
| 25 | const column = Math.max(lessError.column - 1, 0);
|
---|
| 26 |
|
---|
| 27 | if (typeof excerpt[0] === "undefined") {
|
---|
| 28 | excerpt.shift();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | excerpt.push(`${new Array(column).join(" ")}^`);
|
---|
| 32 | return excerpt;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | var _default = LessError;
|
---|
| 38 | exports.default = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.