From 0c0a426d18e3d1e135de5c86be81b3f73abf208c Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 15 May 2015 19:21:59 -0500 Subject: [PATCH] Add named error for server refused TLS --- conn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conn.go b/conn.go index 03f9abc9..9ac9d184 100644 --- a/conn.go +++ b/conn.go @@ -91,6 +91,7 @@ func (ct CommandTag) RowsAffected() int64 { var ErrNoRows = errors.New("no rows in result set") var ErrNotificationTimeout = errors.New("notification timeout") var ErrDeadConn = errors.New("conn is dead") +var ErrTLSRefused = errors.New("server refused TLS connection") type ProtocolError string @@ -916,8 +917,7 @@ func (c *Conn) startTLS() (err error) { } if response[0] != 'S' { - err = errors.New("Could not use TLS") - return + return ErrTLSRefused } c.conn = tls.Client(c.conn, c.config.TLSConfig)