From 1558987979c58286747e7c90ab181adc1560f027 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Thu, 22 Aug 2019 20:11:27 -0500 Subject: [PATCH] ReceiveMessage returns context error instead of io error on cancel --- pgconn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pgconn.go b/pgconn.go index e51d40e8..5d84871b 100644 --- a/pgconn.go +++ b/pgconn.go @@ -361,6 +361,9 @@ func (pgConn *PgConn) ReceiveMessage(ctx context.Context) (pgproto3.BackendMessa defer pgConn.contextWatcher.Unwatch() msg, err := pgConn.receiveMessage() + if err != nil { + err = linkErrors(ctx.Err(), err) + } return msg, err }