feat: refactoring project
This commit is contained in:
15
node_modules/webpack/lib/AbstractMethodError.js
generated
vendored
15
node_modules/webpack/lib/AbstractMethodError.js
generated
vendored
@@ -13,18 +13,22 @@ const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
|
||||
* @returns {string} message
|
||||
*/
|
||||
function createMessage(method) {
|
||||
return `Abstract method${method ? " " + method : ""}. Must be overridden.`;
|
||||
return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function Message() {
|
||||
/** @type {string} */
|
||||
/** @type {string | undefined} */
|
||||
this.stack = undefined;
|
||||
Error.captureStackTrace(this);
|
||||
/** @type {RegExpMatchArray} */
|
||||
const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
|
||||
/** @type {RegExpMatchArray | null} */
|
||||
const match =
|
||||
/** @type {string} */
|
||||
(/** @type {unknown} */ (this.stack))
|
||||
.split("\n")[3]
|
||||
.match(CURRENT_METHOD_REGEXP);
|
||||
|
||||
this.message = match && match[1] ? createMessage(match[1]) : createMessage();
|
||||
}
|
||||
@@ -32,12 +36,13 @@ function Message() {
|
||||
/**
|
||||
* Error for abstract method
|
||||
* @example
|
||||
* ```js
|
||||
* class FooClass {
|
||||
* abstractMethod() {
|
||||
* throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden.
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
class AbstractMethodError extends WebpackError {
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user