#[non_exhaustive]pub enum ErrorKind {
UniqueViolation,
ForeignKeyViolation,
NotNullViolation,
CheckViolation,
SerializationFailure,
Deadlock,
Busy,
NotFound,
Other,
}Expand description
What kind of failure an error is, named the same on every driver.
DrizzleError::kind reads it from the driver’s own error: the
SQLSTATE on PostgreSQL, the extended result code (or SQLite’s message,
where the driver reports only text) on SQLite, libsql, turso, D1 and
Durable Objects, and the server error number on MySQL.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UniqueViolation
A UNIQUE or PRIMARY KEY constraint rejected a duplicate value.
ForeignKeyViolation
A FOREIGN KEY constraint rejected a row: its parent is missing, or
a child still points at the row being removed.
NotNullViolation
A NOT NULL column got no value.
CheckViolation
A CHECK constraint rejected a row.
SerializationFailure
A serializable transaction conflicted with a concurrent one. Run the transaction again.
Deadlock
The database broke a deadlock by failing this statement. Run the transaction again.
Busy
The database or a row is locked by another connection, and waiting
for it failed (SQLite SQLITE_BUSY, a lock timeout). Try again.
NotFound
A query that returns exactly one row returned none.
Other
Any other failure.
Implementations§
Source§impl ErrorKind
impl ErrorKind
Sourcepub const fn is_constraint_violation(self) -> bool
pub const fn is_constraint_violation(self) -> bool
Whether a constraint rejected the statement.
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Whether running the statement or transaction again can succeed:
SerializationFailure,
Deadlock and Busy.