Skip to content
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

Add error subclass mappings for more SQLSTATEs #271

Merged
merged 1 commit into from
Sep 21, 2017

Conversation

bobince
Copy link
Contributor

@bobince bobince commented Aug 16, 2017

Detect more operational error codes so we can raise more specific error classes for these known cases (seen coming from MSSQL — I can't vouch that these offer any improvement for other DBMSs).

Detect more operational error codes so we can raise more specific error classes for these known cases (seen coming from MSSQL — I can't vouch that these offer any improvement for other DBMSs).
Copy link
Owner

@mkleehammer mkleehammer left a comment

Choose a reason for hiding this comment

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

This looks good. Can you update 08003 and squash them? I can do it, of course, but I'd rather you show up as the author since you did the work!

Thanks

@@ -19,15 +19,27 @@ struct SqlStateMapping

static const struct SqlStateMapping sql_state_mapping[] =
{
{ "01002", 5, &OperationalError },
{ "08001", 5, &OperationalError },
{ "08003", 5, &OperationalError },
Copy link
Owner

Choose a reason for hiding this comment

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

08003 is "Connection not open". Wouldn't that be ProgrammingError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we've had it, it has been the result of executing a query on a connection that has unexpectedly closed at the server end (eg due to a timeout), which feels more like an operational problem.

(Although, it's unclear whether this is what the sqlstate is supposed to represent, as the definitions are pretty fuzzy and don't necessarily match reality...)

Copy link
Owner

Choose a reason for hiding this comment

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

Well then, let's leave them as-is. Thanks.

@mkleehammer mkleehammer merged commit a60c6d5 into mkleehammer:master Sep 21, 2017
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