Skip to main content

extract_constraint_value

Function extract_constraint_value 

Source
pub fn extract_constraint_value(db_err: &dyn DatabaseError) -> Option<String>
Expand description

Extracts the conflicting value from a database error’s constraint violation.

Downcasts to sqlx::postgres::PgDatabaseError, reads its detail(), and parses the conflicting value.

Security note: see parse_constraint_detail_value — the returned value may be PII and must not be exposed to untrusted clients.