diff --git a/krb5.go b/krb5.go index f2dbe45..08427b8 100644 --- a/krb5.go +++ b/krb5.go @@ -2,6 +2,8 @@ package pgconn import ( "errors" + "fmt" + "github.com/jackc/pgproto3/v2" ) @@ -85,10 +87,13 @@ func (c *PgConn) rxGSSContinue() (*pgproto3.AuthenticationGSSContinue, error) { if err != nil { return nil, err } - gssContinue, ok := msg.(*pgproto3.AuthenticationGSSContinue) - if ok { - return gssContinue, nil + + switch m := msg.(type) { + case *pgproto3.AuthenticationGSSContinue: + return m, nil + case *pgproto3.ErrorResponse: + return nil, ErrorResponseToPgError(m) } - return nil, errors.New("expected AuthenticationGSSContinue message but received unexpected message") + return nil, fmt.Errorf("expected AuthenticationGSSContinue message but received unexpected message %T", msg) }