pgconn: normalize starTLS connection error

Normalize the error that is returned by startTLS in pgconn.connect. This
makes it possible to determine if the error was a context error.
pull/1837/head
Samuel Stauffer 2023-12-13 13:21:51 -08:00 committed by Jack Christensen
parent df3c5f4df8
commit 2daeb8dc5f
1 changed files with 1 additions and 1 deletions
pgconn

View File

@ -295,7 +295,7 @@ func connect(ctx context.Context, config *Config, fallbackConfig *FallbackConfig
pgConn.contextWatcher.Unwatch() // Always unwatch `netConn` after TLS.
if err != nil {
netConn.Close()
return nil, &connectError{config: config, msg: "tls error", err: err}
return nil, &connectError{config: config, msg: "tls error", err: normalizeTimeoutError(ctx, err)}
}
pgConn.conn = nbTLSConn