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") }) }) })