File size: 454 Bytes
aa89cb5
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { UserContext } from './context';
import { CheckResult } from './i18n';

export interface EntityChecker {
  checkAndFix(context: UserContext, mutation: any, results: CheckResult[]): void;
}

export class CheckException extends Error {
  constructor(public readonly violations: readonly CheckResult[]) {
    super(`Check failed: ${violations.map(v => v.message ?? `${v.ruleId}:${v.location}`).join('; ')}`);
    this.name = 'CheckException';
  }
}