export 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; } }