Skip to content

Commit c770305

Browse files
committed
multi line message when "from" is set
1 parent 9fbe914 commit c770305

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

lib/ModuleBuildError.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ class ModuleBuildError extends WebpackError {
1212
let message = "Module build failed";
1313
let details = undefined;
1414
if (from) {
15-
message += ` (from ${from})`;
15+
message += ` (from ${from}):\n`;
16+
} else {
17+
message += ": ";
1618
}
17-
message += ": ";
1819
if (err !== null && typeof err === "object") {
1920
if (typeof err.stack === "string" && err.stack) {
2021
const stack = cutOffLoaderExecution(err.stack);

lib/ModuleError.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ class ModuleError extends WebpackError {
1111
constructor(module, err, { from = null } = {}) {
1212
let message = "Module Error";
1313
if (from) {
14-
message += ` (from ${from})`;
14+
message += ` (from ${from}):\n`;
15+
} else {
16+
message += ": ";
1517
}
1618
if (err && typeof err === "object" && err.message) {
17-
message += `:\n${err.message}`;
19+
message += err.message;
1820
} else if (err) {
19-
message += `:\n${err}`;
21+
message += err;
2022
}
2123
super(message);
2224
this.name = "ModuleError";

lib/ModuleWarning.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ class ModuleWarning extends WebpackError {
1111
constructor(module, warning, { from = null } = {}) {
1212
let message = "Module Warning";
1313
if (from) {
14-
message += ` (from ${from})`;
14+
message += ` (from ${from}):\n`;
15+
} else {
16+
message += ": ";
1517
}
1618
if (warning && typeof warning === "object" && warning.message) {
17-
message += `:\n${warning.message}`;
19+
message += warning.message;
1820
} else if (warning) {
19-
message += `:\n${warning}`;
21+
message += warning;
2022
}
2123
super(message);
2224
this.name = "ModuleWarning";

0 commit comments

Comments
 (0)