36 lines
948 B
TypeScript
36 lines
948 B
TypeScript
import {
|
|
defineCodes,
|
|
SuaveplanError,
|
|
type SuaveplanErrorOptions,
|
|
} from "@suaveplan/error";
|
|
|
|
/**
|
|
* Error code registry for `@suaveplan/pseudo-random`.
|
|
*/
|
|
export const PSEUDO_RANDOM_CODES = defineCodes("PSEUDO_RANDOM", [
|
|
"SEED.INVALID",
|
|
"SEED.NOT_FINITE",
|
|
"SEED.NOT_SAFE_INT",
|
|
"STATE.INVALID",
|
|
"STATE.ALGORITHM_MISMATCH",
|
|
"ARG.INVALID",
|
|
"ARG.EMPTY_ARRAY",
|
|
"ARG.NEGATIVE_COUNT",
|
|
"ARG.WEIGHTS_INVALID",
|
|
] as const);
|
|
|
|
export type PseudoRandomCode =
|
|
(typeof PSEUDO_RANDOM_CODES)[keyof typeof PSEUDO_RANDOM_CODES];
|
|
|
|
/** Typed error for `@suaveplan/pseudo-random`. */
|
|
export class PseudoRandomError extends SuaveplanError<PseudoRandomCode> {
|
|
// biome-ignore lint/complexity/noUselessConstructor: widens visibility
|
|
public constructor(
|
|
code: PseudoRandomCode,
|
|
messageKey: string,
|
|
options?: SuaveplanErrorOptions
|
|
) {
|
|
super(code, messageKey, options);
|
|
}
|
|
}
|