fix: properly handle rows.Err() (#4261)

* fix (auth): properly handle rows.Err()

* fix (auth/ldap): properly handle rows.Err()

* fix (auth/oidc): properly handle rows.Err()

* fix (auth/password): properly handle rows.Err()

* fix (authtoken): properly handle rows.Err()

* fix (credential): properly handle rows.Err()

* fix (credential/static): properly handle rows.Err()

* fix (credential/vault): properly handle rows.Err()

* fix (db): properly handle rows.Err()

* fix (db/schema): properly handle rows.Err()

* fix (db/migrations): properly handle rows.Err()

* fix (host): properly handle rows.Err()

* fix (host/plugin): properly handle rows.Err()

* fix (host/static): properly handle rows.Err()

* fix (iam): properly handle rows.Err()

* fix (kms): properly handle rows.Err()

* fix (oplog): properly handle rows.Err()

* fix (pagination/purge): properly handle rows.Err()

* fix (plugin): properly handle rows.Err()

* fix (job/scheduler): properly handle rows.Err()

* fix (server): properly handle rows.Err()

* fix (session): properly handle rows.Err()

* fix (target): properly handle rows.Err()
This commit is contained in:
Jim authored and GitHub committed 2024-01-22 14:03:40 -05:00
1 parent c6714c1302
commit 6a37c93d77
59 files changed
+252 -2

No files matched your search

+3
View File
@@ -157,6 +157,9 @@ func nextSync(ctx context.Context, j scheduler.Job) (time.Duration, error) {
if !rows.Next() {
return setSyncJobRunInterval, nil
}
if err := rows.Err(); err != nil {
return 0, errors.Wrap(ctx, err, op)
}
type NextResync struct {
SyncNow bool
+6
View File
@@ -117,6 +117,9 @@ func (r *Repository) queryHosts(ctx context.Context, query string, args []any) (
return err
}
}
if err := rows.Err(); err != nil {
return err
}
if len(foundHosts) != 0 {
plg = plugin.NewPlugin()
plg.PublicId = foundHosts[0].PluginId
@@ -223,5 +226,8 @@ func (r *Repository) estimatedHostCount(ctx context.Context) (int, error) {
return 0, errors.Wrap(ctx, err, op, errors.WithMsg("failed to query plugin hosts"))
}
}
if err := rows.Err(); err != nil {
return 0, errors.Wrap(ctx, err, op, errors.WithMsg("failed to query plugin hosts"))
}
return count, nil
}
@@ -678,6 +678,9 @@ func (r *Repository) querySets(ctx context.Context, query string, args []any) ([
return err
}
}
if err := rows.Err(); err != nil {
return err
}
if len(foundSets) != 0 {
plg = plugin.NewPlugin()
plg.PublicId = foundSets[0].PluginId
@@ -917,6 +920,9 @@ func (r *Repository) estimatedSetCount(ctx context.Context) (int, error) {
return 0, errors.Wrap(ctx, err, op, errors.WithMsg("failed to query plugin host sets"))
}
}
if err := rows.Err(); err != nil {
return 0, errors.Wrap(ctx, err, op, errors.WithMsg("failed to query plugin host sets"))
}
return count, nil
}