ConstraintViolationException

class ConstraintViolationException(val messageEnum: ConstraintViolationExceptionMessage, val tableName: String? = null, val columnName: String? = null, val constraintName: String? = null, queryContext: QueryContext?, cause: Throwable?) : DatabaseException

Exception thrown when a database operation violates data integrity constraints.

This is a common exception for handling domain rules enforced by the database (e.g., "Email already exists" or "Referenced user not found").

It provides metadata like tableName, columnName, and constraintName if provided by the database driver.

Constructors

Link copied to clipboard
constructor(messageEnum: ConstraintViolationExceptionMessage, tableName: String? = null, columnName: String? = null, constraintName: String? = null, queryContext: QueryContext?, cause: Throwable?)

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val message: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun getDetailedMessage(): String

Subclasses can provide additional technical details here.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Enriches the exception with a full query context.

Link copied to clipboard

Enriches the exception with the transaction step index.