-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I noticed when working on a project that I wasn't getting any results from Cassandra, even though there were results in the database. My code looks like something like this:
qs := "SELECT a, b, c FROM my_table"
query := cqlr.BindQuery(s.Session.Query(qs))
var object MyObject
objects := make([]MyObject, 0)
for query.Scan(&object) {
objects = append(objects, object)
}
if err := query.Close(); err != nil {
return objects, err
}
return objects, nil
Given that MyObject is special in how it is marshalled / unmarshalled, I suspected that there was some error in how I conduct that, but the above code throws no errors.
As it turns out, cqlr masks the error. On cqlr.go#L74, an error is only returned if cqlr had a problem. If there is a problem unmarshalling (as might happen in cqlr.go#L107, the error won't be caught until iter is closed... which doesn't happen.
I think that all that is needed is that in Binding.Close, it returns b.err or b.iter.Close().
Metadata
Metadata
Assignees
Labels
No labels