Feature: Add exclusion violation error kind#3918
Merged
abonander merged 2 commits intolaunchbadge:mainfrom Jul 4, 2025
barskern:feature/exclusion-violation
Merged
Feature: Add exclusion violation error kind#3918abonander merged 2 commits intolaunchbadge:mainfrom barskern:feature/exclusion-violation
abonander merged 2 commits intolaunchbadge:mainfrom
barskern:feature/exclusion-violation
Conversation
abonander
requested changes
Jul 2, 2025
Collaborator
abonander
left a comment
There was a problem hiding this comment.
Would you please add a test here: https://github.com/launchbadge/sqlx/blob/main/tests/postgres/error.rs
Also, is this applicable to the other drivers?
Contributor
Author
Of course, tried to grep for tests with that enum but didn't really find it, so thanks for pointing me to it!
I am not too familiar with the other drivers, though from some googling it seems as though both SQLite and MSSQL doesn't have it (they rather have check constraints it seems). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A rather trival addition, though there are other error codes which could probably be considered aswell. It seems as though the selection of error kinds has been kept small for a reason, i.e. only add error kind for the most "normal" errors a user would want to programmatically handle, do something with. For my usecase, the exclusion violation fits this premise, and I would say it's destinct enough from the unique violation to deserve it's own kind. Anyhow, thank you for a great library, and feel free to do with this PR what you want! 😄
Does your PR solve an issue?
No.
Is this a breaking change?
No, the enum is marked as
non_exhaustive, so adding a variant is backwards compatible.