MCPcopy Index your code
hub / github.com/webpack/webpack / constructor

Method constructor

lib/errors/ModuleError.js:20–42  ·  view source on GitHub ↗

* @param {Error} err error thrown * @param {{ from?: string | null }} info additional info

(err, { from = null } = {})

Source from the content-addressed store, hash-verified

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 /** @type {string} */
34 this.name = "ModuleError";
35 /** @type {Error} */
36 this.error = err;
37 /** @type {string | undefined} */
38 this.details =
39 err && typeof err === "object" && err.stack
40 ? cleanUp(err.stack, this.message)
41 : undefined;
42 }
43
44 /**
45 * Serializes this instance into the provided serializer context.

Callers

nothing calls this directly

Calls 1

cleanUpFunction · 0.85

Tested by

no test coverage detected