source: imaps-frontend/node_modules/webpack/lib/ModuleError.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[79a0317]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const { cleanUp } = require("./ErrorHelpers");
9const WebpackError = require("./WebpackError");
10const makeSerializable = require("./util/makeSerializable");
11
12/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
13/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
14
15class ModuleError extends WebpackError {
16 /**
17 * @param {Error} err error thrown
18 * @param {{from?: string|null}} info additional info
19 */
20 constructor(err, { from = null } = {}) {
21 let message = "Module Error";
22
23 message += from ? ` (from ${from}):\n` : ": ";
24
25 if (err && typeof err === "object" && err.message) {
26 message += err.message;
27 } else if (err) {
28 message += err;
29 }
30
31 super(message);
32
33 this.name = "ModuleError";
34 this.error = err;
35 this.details =
36 err && typeof err === "object" && err.stack
37 ? cleanUp(err.stack, this.message)
38 : undefined;
39 }
40
41 /**
42 * @param {ObjectSerializerContext} context context
43 */
44 serialize(context) {
45 const { write } = context;
46
47 write(this.error);
48
49 super.serialize(context);
50 }
51
52 /**
53 * @param {ObjectDeserializerContext} context context
54 */
55 deserialize(context) {
56 const { read } = context;
57
58 this.error = read();
59
60 super.deserialize(context);
61 }
62}
63
64makeSerializable(ModuleError, "webpack/lib/ModuleError");
65
66module.exports = ModuleError;
Note: See TracBrowser for help on using the repository browser.