import type SendableError from "./SendableError.js"; import type { DefaultSendableErrorDetails, SendableErrorDetails } from "./SendableError.js"; export interface ErrorCodeProperties { id: string; defaultMessage: string; status?: number; } export interface BaseErrorCode<_D extends SendableErrorDetails = DefaultSendableErrorDetails> { getId(): string; getDefaultMessage(): string | undefined; is(error: any): error is SendableError; getStatus(): number | undefined; } export default class ErrorCode implements BaseErrorCode { private readonly properties; static DEFAULT_CODE: ErrorCode; readonly prefix: string; constructor(properties: ErrorCodeProperties); getDefaultMessage(): string | undefined; getId(): string; /** * Does this error have this code? */ is(error: any): error is SendableError; /** * Extends an existing error code */ private extend; static get(error: Error): BaseErrorCode; getStatus(): number | undefined; toString(): string; }