UNPKG

926 BTypeScriptView Raw
1import { CommonErrorProperties, ErrorOptions } from '../base-error';
2import ValidationError, { ValidationErrorItem } from '../validation-error';
3interface UniqueConstraintErrorParent extends Error, Pick<CommonErrorProperties, 'sql'> {
4}
5export interface UniqueConstraintErrorOptions extends ErrorOptions {
6 parent?: UniqueConstraintErrorParent;
7 original?: UniqueConstraintErrorParent;
8 errors?: ValidationErrorItem[];
9 fields?: Record<string, unknown>;
10 message?: string;
11}
12/**
13 * Thrown when a unique constraint is violated in the database
14 */
15declare class UniqueConstraintError extends ValidationError implements CommonErrorProperties {
16 readonly parent: UniqueConstraintErrorParent;
17 readonly original: UniqueConstraintErrorParent;
18 readonly fields: Record<string, unknown>;
19 readonly sql: string;
20 constructor(options: UniqueConstraintErrorOptions);
21}
22export default UniqueConstraintError;