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

pgconn: normalize more connection errors #1835

Merged
merged 2 commits into from
Dec 16, 2023

Conversation

samuel
Copy link
Contributor

@samuel samuel commented Dec 13, 2023

Normalize the error that is returned by startTLS in pgconn.connect. This makes it possible to determine if the error was a context error. Before this change the returned error for a context that is canceled or hits the deadline would be tls error (read tcp 127.0.0.1:55914->127.0.0.1:5432: i/o timeout).

This change also uses errors.As to unwrap errors in normalizeTimeoutError. This allows the function to handle the writeError type that shows up as failed to write startup message (read tcp 127.0.0.1:55914->127.0.0.1:5432: i/o timeout).

Normalize the error that is returned by startTLS in pgconn.connect. This
makes it possible to determine if the error was a context error.
@samuel samuel changed the title pgconn: normalize starTLS connection error pgconn: normalize startTLS connection error Dec 13, 2023
@samuel samuel changed the title pgconn: normalize startTLS connection error pgconn: normalize more connection errors Dec 14, 2023
@jackc jackc merged commit 9ab9e3c into jackc:master Dec 16, 2023
14 checks passed
@jackc
Copy link
Owner

jackc commented Dec 16, 2023

LGTM - thanks!

@samuel samuel deleted the normalize-tls-start-error branch December 18, 2023 15:55
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