Skip to content

Commit

Permalink
refactor: remove usage of mixin on error classes (#10128)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx authored Feb 13, 2024
1 parent 54106db commit f48cb2a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3915,23 +3915,23 @@ export enum DiscordjsErrorCodes {
EntitlementCreateInvalidOwner = 'EntitlementCreateInvalidOwner',
}

/** @internal */
export interface DiscordjsErrorFields<Name extends string> {
readonly name: `${Name} [${DiscordjsErrorCodes}]`;
get code(): DiscordjsErrorCodes;
export class DiscordjsError extends Error {
private constructor(code: DiscordjsErrorCodes, ...args: unknown[]);
public readonly code: DiscordjsErrorCodes;
public get name(): `Error [${DiscordjsErrorCodes}]`;
}

/** @internal */
export function DiscordjsErrorMixin<Entity, Name extends string>(
Base: Constructable<Entity>,
name: Name,
): Constructable<Entity & DiscordjsErrorFields<Name>>;

export class DiscordjsError extends DiscordjsErrorMixin(Error, 'Error') {}

export class DiscordjsTypeError extends DiscordjsErrorMixin(TypeError, 'TypeError') {}
export class DiscordjsTypeError extends TypeError {
private constructor(code: DiscordjsErrorCodes, ...args: unknown[]);
public readonly code: DiscordjsErrorCodes;
public get name(): `TypeError [${DiscordjsErrorCodes}]`;
}

export class DiscordjsRangeError extends DiscordjsErrorMixin(RangeError, 'RangeError') {}
export class DiscordjsRangeError extends RangeError {
private constructor(code: DiscordjsErrorCodes, ...args: unknown[]);
public readonly code: DiscordjsErrorCodes;
public get name(): `RangeError [${DiscordjsErrorCodes}]`;
}

//#endregion

Expand Down

0 comments on commit f48cb2a

Please sign in to comment.