From 846c3420e78b3dc7c7eaf5ae19ef23c8a2a08b54 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 19 Sep 2023 15:32:12 +0200 Subject: [PATCH] Add module errors for failed profile migrations --- profile/migrations.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/profile/migrations.go b/profile/migrations.go index 3a5d52e5..41fa7319 100644 --- a/profile/migrations.go +++ b/profile/migrations.go @@ -162,6 +162,13 @@ func migrateIcons(ctx context.Context, _, to *version.Version, db *database.Inte // Log migration failure and try again next time. if lastErr != nil { + // Normally, an icon migration would not be such a big error, but this is a test + // run for the profile IDs and we absolutely need to know if anything went wrong. + module.Error( + "migration-failed", + "Profile Migration Failed", + fmt.Sprintf("Failed to migrate icons of %d profiles (out of %d pending). The last error was: %s\n\nPlease restart Portmaster to try the migration again.", failed, total, lastErr), + ) return fmt.Errorf("failed to migrate %d profiles (out of %d pending) - last error: %w", failed, total, lastErr) } @@ -243,6 +250,11 @@ func migrateToDerivedIDs(ctx context.Context, _, to *version.Version, db *databa // Log migration failure and try again next time. if lastErr != nil { + module.Error( + "migration-failed", + "Profile Migration Failed", + fmt.Sprintf("Failed to migrate profile IDs of %d profiles (out of %d pending). The last error was: %s\n\nPlease restart Portmaster to try the migration again.", failed, total, lastErr), + ) return fmt.Errorf("failed to migrate %d profiles (out of %d pending) - last error: %w", failed, total, lastErr) }