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