PrismaErrorMapper class

Maps database-specific error codes to PrismaException types.

Each database has its own error code system:

  • PostgreSQL: 5-character SQLSTATE codes (e.g., '23505' for unique violation)
  • MySQL: numeric error codes (e.g., 1062 for duplicate key)
  • SQLite: numeric error codes (e.g., 19 for constraint)

Constructors

PrismaErrorMapper()

Properties

hashCode int
The hash code for this object.
no setterinherited
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.
inherited

Operators

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

Static Methods

fromMySqlError(String message, {int? errorCode, String? constraintName, Object? originalError}) PrismaException
Map a MySQL error to a PrismaException.
fromPostgresError(String message, {String? sqlState, String? constraintName, Object? originalError}) PrismaException
Map a PostgreSQL error to a PrismaException.
fromSqliteError(String message, {int? errorCode, Object? originalError}) PrismaException
Map a SQLite error to a PrismaException.