Skip to main content

db_error_field

Function db_error_field 

Source
pub fn db_error_field(e: &AppError) -> Option<String>
Expand description

Extract the column name from a PostgreSQL error. Extract a field name from a database constraint violation error, where available. On Postgres, this parses the detail field of PgDatabaseError (e.g. “Key (email)=… already exists”). On other dialects the function returns None — callers fall back to generic messages.