Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | /*
|
---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
| 3 | Author Jarid Margolin @jaridmargolin
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | const inspect = require("util").inspect.custom;
|
---|
| 9 | const makeSerializable = require("./util/makeSerializable");
|
---|
| 10 |
|
---|
| 11 | /** @typedef {import("./Chunk")} Chunk */
|
---|
| 12 | /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
---|
| 13 | /** @typedef {import("./Module")} Module */
|
---|
| 14 |
|
---|
| 15 | class WebpackError extends Error {
|
---|
| 16 | /**
|
---|
| 17 | * Creates an instance of WebpackError.
|
---|
| 18 | * @param {string=} message error message
|
---|
| 19 | */
|
---|
| 20 | constructor(message) {
|
---|
| 21 | super(message);
|
---|
| 22 |
|
---|
| 23 | this.details = undefined;
|
---|
| 24 | /** @type {Module} */
|
---|
| 25 | this.module = undefined;
|
---|
| 26 | /** @type {DependencyLocation} */
|
---|
| 27 | this.loc = undefined;
|
---|
| 28 | /** @type {boolean} */
|
---|
| 29 | this.hideStack = undefined;
|
---|
| 30 | /** @type {Chunk} */
|
---|
| 31 | this.chunk = undefined;
|
---|
| 32 | /** @type {string} */
|
---|
| 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.