Something went wrong. Try again.
because I got bored of customising my CV for every job
Something went wrong. Try again.
TypeScript
12345678910111213141516export interface ErrorVariables { [key: string]: string | number | string[] | number[];}
export abstract class DomainError extends Error { public readonly code: string; public readonly variables: ErrorVariables;
constructor(code: string, message: string, variables: ErrorVariables = {}) { super(message); this.code = code; this.variables = variables; this.name = this.constructor.name; }}