From 67ad75242ae521981399d91d11456d2814e35343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Sat, 27 Aug 2022 12:33:18 -0300 Subject: [PATCH] Improve some error messages --- ksql.go | 4 ++-- test_adapters.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ksql.go b/ksql.go index 15554ba..41d4869 100644 --- a/ksql.go +++ b/ksql.go @@ -192,11 +192,11 @@ func (c DB) Query( } if rows.Err() != nil { - return rows.Err() + return fmt.Errorf("KSQL: unexpected error when parsing query result: %w", rows.Err()) } if err := rows.Close(); err != nil { - return err + return fmt.Errorf("KSQL: unexpected error when closing query result rows: %w", err) } // Update the original slice passed by reference: diff --git a/test_adapters.go b/test_adapters.go index 10547bd..5fdfd5e 100644 --- a/test_adapters.go +++ b/test_adapters.go @@ -534,7 +534,7 @@ func QueryTest( var users []user err := c.Query(ctx, &users, `SELECT * FROM users`) - tt.AssertErrContains(t, err, "fakeErrMsg") + tt.AssertErrContains(t, err, "KSQL", "fakeErrMsg") }) t.Run("should report error if DBAdapter.Close() returns an error", func(t *testing.T) { @@ -560,7 +560,7 @@ func QueryTest( var users []user err := c.Query(ctx, &users, `SELECT * FROM users`) - tt.AssertErrContains(t, err, "fakeCloseErr") + tt.AssertErrContains(t, err, "KSQL", "fakeCloseErr") }) }) })