diff --git a/lib/sql/rows.go b/lib/sql/rows.go index 6ed500748..3336012a9 100644 --- a/lib/sql/rows.go +++ b/lib/sql/rows.go @@ -1,6 +1,9 @@ package sql -import "database/sql" +import ( + "database/sql" + "fmt" +) func RowsToObjects(rows *sql.Rows) ([]map[string]any, error) { defer rows.Close() @@ -30,5 +33,9 @@ func RowsToObjects(rows *sql.Rows) ([]map[string]any, error) { objects = append(objects, object) } + if err = rows.Err(); err != nil { + return nil, fmt.Errorf("failed to iterate over rows: %w", err) + } + return objects, nil }