[Postgres] add constraint()
to the DatabaseError
trait, which covers most uses of downcasting
#821
Labels
constraint()
to the DatabaseError
trait, which covers most uses of downcasting
#821
In my experience, far and away the primary reason to use
DatabaseError::downcast_ref()
is to check the constraint name. It would be nice not to have to downcast, though:https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/error.rs#L146
This only needs to be overridden by
PgDatabaseError
as unfortunately none of the other databases have this context in their errors.https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/postgres/error.rs#L164
The text was updated successfully, but these errors were encountered: