Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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
PgDatabaseErroras 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