mirror of https://github.com/VinGarcia/ksql.git
Improve some error messages
parent
86dd623eac
commit
67ad75242a
4
ksql.go
4
ksql.go
|
@ -192,11 +192,11 @@ func (c DB) Query(
|
||||||
}
|
}
|
||||||
|
|
||||||
if rows.Err() != nil {
|
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 {
|
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:
|
// Update the original slice passed by reference:
|
||||||
|
|
|
@ -534,7 +534,7 @@ func QueryTest(
|
||||||
|
|
||||||
var users []user
|
var users []user
|
||||||
err := c.Query(ctx, &users, `SELECT * FROM users`)
|
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) {
|
t.Run("should report error if DBAdapter.Close() returns an error", func(t *testing.T) {
|
||||||
|
@ -560,7 +560,7 @@ func QueryTest(
|
||||||
|
|
||||||
var users []user
|
var users []user
|
||||||
err := c.Query(ctx, &users, `SELECT * FROM users`)
|
err := c.Query(ctx, &users, `SELECT * FROM users`)
|
||||||
tt.AssertErrContains(t, err, "fakeCloseErr")
|
tt.AssertErrContains(t, err, "KSQL", "fakeCloseErr")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue