ForeignKeyException class

Foreign key constraint violation.

Thrown when trying to create/update a record with a foreign key that references a non-existent record.

PostgreSQL error code: 23503

Inheritance

Constructors

ForeignKeyException(String message, {String? code = 'P2003', Object? originalError, Map<String, dynamic>? context, String? constraintName, String? field, String? referencedTable})
const

Properties

code String?
Prisma error code (e.g., P2002 for unique constraint violation)
finalinherited
constraintName String?
Name of the foreign key constraint
final
context Map<String, dynamic>?
Additional context about the error
finalinherited
field String?
Field 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
referencedTable String?
Referenced table
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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