Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
815 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * **PostCSS Syntax Error**
|
---|
| 5 | *
|
---|
| 6 | * Loader wrapper for postcss syntax errors
|
---|
| 7 | *
|
---|
| 8 | * @class SyntaxError
|
---|
| 9 | * @extends Error
|
---|
| 10 | *
|
---|
| 11 | * @param {Object} err CssSyntaxError
|
---|
| 12 | */
|
---|
| 13 | class SyntaxError extends Error {
|
---|
| 14 | constructor(error) {
|
---|
| 15 | super(error);
|
---|
| 16 | const {
|
---|
| 17 | line,
|
---|
| 18 | column,
|
---|
| 19 | reason,
|
---|
| 20 | plugin,
|
---|
| 21 | file
|
---|
| 22 | } = error;
|
---|
| 23 | this.name = "SyntaxError";
|
---|
| 24 | this.message = `${this.name}\n\n`;
|
---|
| 25 |
|
---|
| 26 | if (typeof line !== "undefined") {
|
---|
| 27 | this.message += `(${line}:${column}) `;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | this.message += plugin ? `${plugin}: ` : "";
|
---|
| 31 | this.message += file ? `${file} ` : "<css input> ";
|
---|
| 32 | this.message += `${reason}`;
|
---|
| 33 | const code = error.showSourceCode();
|
---|
| 34 |
|
---|
| 35 | if (code) {
|
---|
| 36 | this.message += `\n\n${code}\n`;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | this.stack = false;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | module.exports = SyntaxError; |
---|
Note:
See
TracBrowser
for help on using the repository browser.