Fix missing RowsAffected checks in cookie update methods
Address PR review comments: capture Exec result and check RowsAffected() == 0 to return ErrResourceNotFound in Cookie.Update, CookieCategory.Update, and CookieCategory.UpdateRank. Also update coredata and relay contributor docs accordingly. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -129,7 +129,13 @@ assets, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[Asset])
|
||||
*a = assets
|
||||
|
||||
// Update / Delete — no RETURNING
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
result, err := conn.Exec(ctx, q, args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if result.RowsAffected() == 0 {
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
```
|
||||
|
||||
## Sentinel errors
|
||||
|
||||
Reference in New Issue
Block a user