Skip to content

Commit

Permalink
Move check for rows.Err as a last check.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Jan 7, 2025
1 parent 39707d9 commit ecb2d59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sda/internal/database/db_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,6 @@ func (dbs *SDAdb) getCorrID(user, path, accession string) (string, error) {
if err != nil {
return "", err
}
if rows.Err() != nil {
return "", rows.Err()
}
defer rows.Close()

var corrID sql.NullString
Expand All @@ -747,6 +744,9 @@ func (dbs *SDAdb) getCorrID(user, path, accession string) (string, error) {
return corrID.String, nil
}
}
if rows.Err() != nil {
return "", rows.Err()
}

return "", fmt.Errorf("sql: no rows in result set")
}
Expand Down

0 comments on commit ecb2d59

Please sign in to comment.