Skip to content

Commit

Permalink
fix: add an error catch for deferrerd rows errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hiendv committed Mar 28, 2023
1 parent c58b7f6 commit 3b1beee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func OneFromRows[T any](ctx context.Context, m Mapper[T], rows Rows) (T, error)
before, after := m(ctx, v.columnsCopy())

if !rows.Next() {
if err = rows.Err(); err != nil {
return t, err
}
return t, sql.ErrNoRows
}

Expand Down

0 comments on commit 3b1beee

Please sign in to comment.