From cd23da278534fbadfd1b3b5f46b8d7ce3a5bc25d Mon Sep 17 00:00:00 2001 From: Henrik Johansson Date: Thu, 16 May 2019 13:39:02 +0200 Subject: [PATCH] session: explicitly state which system fails a query (cherry picked from commit 4666bf1f74e1d7c8161acfdbaabd90dca8dbc6e5) --- session.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/session.go b/session.go index 62c0d03b..6984ea32 100644 --- a/session.go +++ b/session.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "github.com/pkg/errors" + "github.com/gocql/gocql" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" @@ -66,8 +68,12 @@ func (s *Session) Check(table Table, query string, values ...interface{}) (err e testIter := s.testSession.Query(query, values...).Iter() oracleIter := s.oracleSession.Query(query, values...).Iter() defer func() { - err = multierr.Append(err, testIter.Close()) - err = multierr.Append(err, oracleIter.Close()) + if e := testIter.Close(); e != nil { + err = multierr.Append(err, errors.Errorf("test system failed: %s", err.Error())) + } + if e := oracleIter.Close(); e != nil { + err = multierr.Append(err, errors.Errorf("oracle failed: %s", err.Error())) + } }() testRows := loadSet(testIter)