Skip to main content

is_unique_violation

Function is_unique_violation 

Source
pub fn is_unique_violation(err: &Error) -> bool
Expand description

Returns true when the given sqlx error wraps a SQLite uniqueness constraint violation. SQLite reports these as extended code 2067 (SQLITE_CONSTRAINT_UNIQUE) or, for an INTEGER PRIMARY KEY clash, 1555 (SQLITE_CONSTRAINT_PRIMARYKEY). As with is_fk_violation we also fall back to a substring check of the error message.