You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add driver-side error codes to NpgsqlException #1072
Since 3.1 we throw PostgresException for server-side errors and NpgsqlException for driver-side errors (e.g. network failure). It would be good to add an error code for driver-side errors to allow users to check for them programmatically, i.e. distinguish between SSL negotiation failure, network failure, missing PostgreSQL type when mapping...
Closing for age and lack of interest; NpgsqlException already wraps system exceptions which allow users to understand what happened. If there's interest in anything else, I'll accept a PR and we can also discuss.
@roji - We were interested in adding the error code for SSL exception. Currently we are getting an NpgSQL exception with a message "SSL connection requested. No SSL enabled connection from this host is configured.".
We want to identify this error and handle it separately. Having a proper error code will be very useful. We don't want to do a string match, are there any plans to address this?
If we do something like this, we probably need to move SqlState up from PostgresException to NpgsqlException, and find a standard range within the SQL STATE standard where we can define our own error codes.
Activity
Serious exception work
roji commentedon Jun 8, 2018
Closing for age and lack of interest; NpgsqlException already wraps system exceptions which allow users to understand what happened. If there's interest in anything else, I'll accept a PR and we can also discuss.
swjain23 commentedon Jun 16, 2020
@roji - We were interested in adding the error code for SSL exception. Currently we are getting an NpgSQL exception with a message "SSL connection requested. No SSL enabled connection from this host is configured.".
We want to identify this error and handle it separately. Having a proper error code will be very useful. We don't want to do a string match, are there any plans to address this?
YohDeadfall commentedon Jun 16, 2020
We have no plans on this, but can accept a PR which will specify error codes for all our exceptions or for important at least.
roji commentedon Jun 16, 2020
If we do something like this, we probably need to move SqlState up from PostgresException to NpgsqlException, and find a standard range within the SQL STATE standard where we can define our own error codes.
Am going to open this for the backlog.