Skip to content

Feature: Add exclusion violation error kind#3918

Merged
abonander merged 2 commits intolaunchbadge:mainfrom
barskern:feature/exclusion-violation
Jul 4, 2025
Merged

Feature: Add exclusion violation error kind#3918
abonander merged 2 commits intolaunchbadge:mainfrom
barskern:feature/exclusion-violation

Conversation

@barskern
Copy link
Copy Markdown
Contributor

@barskern barskern commented Jul 2, 2025

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.

Copy link
Copy Markdown
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@barskern
Copy link
Copy Markdown
Contributor Author

barskern commented Jul 2, 2025

Would you please add a test here: https://github.com/launchbadge/sqlx/blob/main/tests/postgres/error.rs

Of course, tried to grep for tests with that enum but didn't really find it, so thanks for pointing me to it!

Also, is this applicable to the other drivers?

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).

@barskern barskern requested a review from abonander July 2, 2025 12:03
@abonander abonander merged commit a0c7769 into launchbadge:main Jul 4, 2025
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants