Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Error.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SyntaxError extends Error {
constructor(error) {
super(error);

const { line, column, reason } = error;
const { line, column, reason, plugin, file } = error;

this.name = 'SyntaxError';

Expand All @@ -22,6 +22,8 @@ class SyntaxError extends Error {
this.message += `(${line}:${column}) `;
}

this.message += plugin ? `${plugin}: ` : '';
this.message += file ? `${file} ` : '<css input> ';
this.message += `${reason}`;

const code = error.showSourceCode();
Expand Down
3 changes: 2 additions & 1 deletion src/Warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Warning extends Error {
constructor(warning) {
super(warning);

const { text, line, column } = warning;
const { text, line, column, plugin } = warning;

this.name = 'Warning';

Expand All @@ -22,6 +22,7 @@ class Warning extends Error {
this.message += `(${line}:${column}) `;
}

this.message += plugin ? `${plugin}: ` : '';
this.message += `${text}`;

this.stack = false;
Expand Down
26 changes: 13 additions & 13 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,51 +58,51 @@ Array [
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(10:3) <Message>",
(10:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(14:3) <Message>",
(14:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(18:3) <Message>",
(18:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(19:3) <Message>",
(19:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(23:3) <Message>",
(23:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(24:3) <Message>",
(24:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(29:5) <Message>",
(29:5) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(2:3) <Message>",
(2:3) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(32:7) <Message>",
(32:7) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(36:7) <Message>",
(36:7) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(41:5) <Message>",
(41:5) postcss-plugin: <Message>",
"ModuleWarning: Module Warning (from \`replaced original path\`):
Warning

(6:3) <Message>",
(6:3) postcss-plugin: <Message>",
]
`;

Expand Down Expand Up @@ -162,7 +162,7 @@ Array [
"ModuleBuildError: Module build failed (from \`replaced original path\`):
SyntaxError

(1:3) Unnecessary curly bracket
(1:3) /test/fixtures/css/style.css Unnecessary curly bracket

> 1 | a {
| ^
Expand Down