-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose error code for PG backend #4290
Conversation
Thanks for opening this PR. Could you provide some more details about which SQL Error codes you want to handle outside of diesel and why that's required. Additionally: I fear we cannot merge the PR as it is as it contains a breaking change (adding a new required method to an public trait). Finally: There should be at least one test for this. |
I'd like to handle exclusion errors, but possibly others if they come up. I'd rather not file a PR for each case though, so it makes more sense IMO to just expose the code. After all, sql state is somewhat standardized AFAIU. Perhaps not the codes themselves, but the concept of a code itself. I will add a test. Would you like me to just add a default implementation to code? |
IMO adding those to I'm not opposed to adding the method currently suggested by this PR but the above feels like a reasonable first step given the compromise that there is otherwise between backwards compatibility (previously mentioned breaking change) and correctness (any existing implementation of this trait is unlikely to be as correct as it should be if we add a default impl for this method). |
@Ten0 Alright, I've just added the remaining constraints to the enum. Do you folks want test for these errors or is this sufficient? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from this
This allows for robust handling of PG errors that are not already enumerated.