mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
Feature: Add exclusion violation error kind (#3918)
* feat: add exclusion violation error kind * chore: add test for exclusion error kind
This commit is contained in:
@@ -214,6 +214,7 @@ impl DatabaseError for PgDatabaseError {
|
||||
error_codes::FOREIGN_KEY_VIOLATION => ErrorKind::ForeignKeyViolation,
|
||||
error_codes::NOT_NULL_VIOLATION => ErrorKind::NotNullViolation,
|
||||
error_codes::CHECK_VIOLATION => ErrorKind::CheckViolation,
|
||||
error_codes::EXCLUSION_VIOLATION => ErrorKind::ExclusionViolation,
|
||||
_ => ErrorKind::Other,
|
||||
}
|
||||
}
|
||||
@@ -239,4 +240,6 @@ pub(crate) mod error_codes {
|
||||
pub const NOT_NULL_VIOLATION: &str = "23502";
|
||||
/// Caused when a check constraint is violated.
|
||||
pub const CHECK_VIOLATION: &str = "23514";
|
||||
/// Caused when a exclude constraint is violated.
|
||||
pub const EXCLUSION_VIOLATION: &str = "23P01";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user