red-black-tree-typed
Version:
33 lines (32 loc) • 1.72 kB
TypeScript
/**
* Centralized error dispatch.
* All library errors go through this function for consistent messaging and easy grep.
* @remarks Always throws — data structure errors are never recoverable.
* @param ErrorClass - The error constructor (Error, TypeError, RangeError, etc.)
* @param message - The error message.
*/
export declare function raise(ErrorClass: new (msg: string) => Error, message: string): never;
/**
* Centralized error message templates.
* Keep using native Error/TypeError/RangeError — this only standardizes messages.
*/
export declare const ERR: {
readonly indexOutOfRange: (index: number, min: number, max: number, ctx?: string) => string;
readonly invalidIndex: (ctx?: string) => string;
readonly invalidArgument: (reason: string, ctx?: string) => string;
readonly comparatorRequired: (ctx?: string) => string;
readonly invalidKey: (reason: string, ctx?: string) => string;
readonly notAFunction: (name: string, ctx?: string) => string;
readonly invalidEntry: (ctx?: string) => string;
readonly invalidNaN: (ctx?: string) => string;
readonly invalidDate: (ctx?: string) => string;
readonly reduceEmpty: (ctx?: string) => string;
readonly callbackReturnType: (expected: string, got: string, ctx?: string) => string;
readonly invalidOperation: (reason: string, ctx?: string) => string;
readonly matrixDimensionMismatch: (op: string) => string;
readonly matrixSingular: () => string;
readonly matrixNotSquare: () => string;
readonly matrixNotRectangular: () => string;
readonly matrixRowMismatch: (expected: number, got: number) => string;
readonly orderStatisticNotEnabled: (method: string, ctx?: string) => string;
};