UniqueConstraintException class

Unique constraint violation.

Thrown when trying to create/update a record that would violate a unique constraint.

PostgreSQL error code: 23505

Inheritance

Constructors

UniqueConstraintException(String message, {String? code = 'P2002', Object? originalError, Map<String, dynamic>? context, List<String>? fields, dynamic value, String? constraintName})
const

Properties

code String?
Prisma error code (e.g., P2002 for unique constraint violation)
finalinherited
constraintName String?
Name of the constraint that was violated
final
context Map<String, dynamic>?
Additional context about the error
finalinherited
fields List<String>?
Field(s) that caused the violation
final
hashCode int
The hash code for this object.
no setterinherited
message String
Human-readable error message
finalinherited
originalError Object?
Original error from the database driver (if available)
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → dynamic
Value that caused the violation
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited