feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -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() {