Fix profile migration iteration error handling and only warn, not fail

This commit is contained in:
Daniel 2022-10-13 11:22:24 +02:00
parent b9127d3f91
commit 028986ed74

View file

@ -2,7 +2,6 @@ package profile
import ( import (
"context" "context"
"fmt"
"github.com/hashicorp/go-version" "github.com/hashicorp/go-version"
@ -62,7 +61,8 @@ func migrateLinkedPath(ctx context.Context, _, to *version.Version, db *database
// Get iterator over all profiles. // Get iterator over all profiles.
it, err := db.Query(query.New(profilesDBPath)) it, err := db.Query(query.New(profilesDBPath))
if err != nil { if err != nil {
return fmt.Errorf("failed to query profiles: %w", err) log.Tracer(ctx).Errorf("profile: failed to migrate from linked path: failed to start query: %s", err)
return nil
} }
// Migrate all profiles. // Migrate all profiles.
@ -91,8 +91,8 @@ func migrateLinkedPath(ctx context.Context, _, to *version.Version, db *database
} }
// Check if there was an error while iterating. // Check if there was an error while iterating.
if it.Err() != nil { if err := it.Err(); err != nil {
return fmt.Errorf("profiles: failed to iterate over profiles for migration: %w", err) log.Tracer(ctx).Errorf("profile: failed to migrate from linked path: failed to iterate over profiles for migration: %s", err)
} }
return nil return nil