1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const inspect = require("util").inspect.custom;
|
9 | const makeSerializable = require("./util/makeSerializable");
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | class WebpackError extends Error {
|
16 | |
17 |
|
18 |
|
19 |
|
20 | constructor(message) {
|
21 | super(message);
|
22 |
|
23 | this.details = undefined;
|
24 |
|
25 | this.module = undefined;
|
26 |
|
27 | this.loc = undefined;
|
28 |
|
29 | this.hideStack = undefined;
|
30 |
|
31 | this.chunk = undefined;
|
32 |
|
33 | this.file = undefined;
|
34 | }
|
35 |
|
36 | [inspect]() {
|
37 | return this.stack + (this.details ? `\n${this.details}` : "");
|
38 | }
|
39 |
|
40 | serialize({ write }) {
|
41 | write(this.name);
|
42 | write(this.message);
|
43 | write(this.stack);
|
44 | write(this.details);
|
45 | write(this.loc);
|
46 | write(this.hideStack);
|
47 | }
|
48 |
|
49 | deserialize({ read }) {
|
50 | this.name = read();
|
51 | this.message = read();
|
52 | this.stack = read();
|
53 | this.details = read();
|
54 | this.loc = read();
|
55 | this.hideStack = read();
|
56 | }
|
57 | }
|
58 |
|
59 | makeSerializable(WebpackError, "webpack/lib/WebpackError");
|
60 |
|
61 | module.exports = WebpackError;
|