Check rows.Err() in the remaining Next() loops (#27)
Incident list, the three stats breakdowns and the user list could return a truncated result as if complete when the scan failed partway.
This commit is contained in:
@@ -100,6 +100,10 @@ func handleListIncidents(db *sql.DB) http.HandlerFunc {
|
||||
}
|
||||
incidents = append(incidents, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
respond(w, http.StatusInternalServerError, errResp("internal error"))
|
||||
return
|
||||
}
|
||||
respond(w, http.StatusOK, incidents)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user