MCPcopy Index your code
hub / github.com/sequelize/sequelize / UniqueConstraintError

Class UniqueConstraintError

src/errors/validation/unique-constraint-error.ts:19–39  ·  view source on GitHub ↗

* Thrown when a unique constraint is violated in the database

Source from the content-addressed store, hash-verified

17 * Thrown when a unique constraint is violated in the database
18 */
19class UniqueConstraintError extends ValidationError implements CommonErrorProperties {
20 readonly parent: UniqueConstraintErrorParent;
21 readonly original: UniqueConstraintErrorParent;
22 readonly fields: Record<string, unknown>;
23 readonly sql: string;
24
25 constructor(options: UniqueConstraintErrorOptions) {
26 options = options ?? {};
27 options.parent = options.parent ?? { sql: '', name: '', message: '' };
28 options.message =
29 options.message || options.parent.message || 'Validation Error';
30 options.errors = options.errors ?? [];
31 super(options.message, options.errors, { stack: options.stack });
32
33 this.name = 'SequelizeUniqueConstraintError';
34 this.fields = options.fields ?? {};
35 this.parent = options.parent;
36 this.original = options.parent;
37 this.sql = options.parent.sql;
38 }
39}
40
41export default UniqueConstraintError;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected