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 | Error.captureStackTrace(this, this.constructor);
|
36 | }
|
37 |
|
38 | [inspect]() {
|
39 | return this.stack + (this.details ? `\n${this.details}` : "");
|
40 | }
|
41 |
|
42 | serialize({ write }) {
|
43 | write(this.name);
|
44 | write(this.message);
|
45 | write(this.stack);
|
46 | write(this.details);
|
47 | write(this.loc);
|
48 | write(this.hideStack);
|
49 | }
|
50 |
|
51 | deserialize({ read }) {
|
52 | this.name = read();
|
53 | this.message = read();
|
54 | this.stack = read();
|
55 | this.details = read();
|
56 | this.loc = read();
|
57 | this.hideStack = read();
|
58 | }
|
59 | }
|
60 |
|
61 | makeSerializable(WebpackError, "webpack/lib/WebpackError");
|
62 |
|
63 | module.exports = WebpackError;
|