Skip to content
rusthacks.dev

Tag

errors

2 posts

Flat illustration for the post “SQLx Error Handling and Unique Violation Detection”, composed around database.
Databases

SQLx Error Handling and Unique Violation Detection

Turn a PostgreSQL unique violation into a friendly conflict instead of a 500. Check is_unique_violation on the database error, read the constraint name and map foreign key errors too.

3 min read