because I got bored of customising my CV for every job
1export interface ErrorVariables {
2 [key: string]: string | number | string[] | number[];
3}
4
5export abstract class DomainError extends Error {
6 public readonly code: string;
7 public readonly variables: ErrorVariables;
8
9 constructor(code: string, message: string, variables: ErrorVariables = {}) {
10 super(message);
11 this.code = code;
12 this.variables = variables;
13 this.name = this.constructor.name;
14 }
15}