Description
In pkg/gofr/datasource/sql/db.go, the selectSlice() and selectStruct() methods check for row iteration errors using rows.Err(), but then log the wrong variable. They log the earlier query error (err) instead of the actual row iteration error (rows.Err()), making it impossible to diagnose row parsing failures from logs.
Steps to Reproduce
- Have a scenario where row iteration encounters an error (e.g., connection drop mid-read)
- Check the error log output
Expected Behavior
The log should show the actual row iteration error returned by rows.Err().
Actual Behavior
The log shows the earlier query error variable which is nil at that point, so the log message contains no useful error information.