1 | "use strict";
|
2 |
|
3 | const WebpackError = require("./WebpackError");
|
4 | const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function createMessage(method) {
|
11 | return `Abstract method${method ? " " + method : ""}. Must be overridden.`;
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function Message() {
|
18 | this.stack = undefined;
|
19 | Error.captureStackTrace(this);
|
20 |
|
21 | const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
|
22 |
|
23 | this.message = match && match[1] ? createMessage(match[1]) : createMessage();
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | class AbstractMethodError extends WebpackError {
|
37 | constructor() {
|
38 | super(new Message().message);
|
39 | this.name = "AbstractMethodError";
|
40 | }
|
41 | }
|
42 |
|
43 | module.exports = AbstractMethodError;
|