From bec721cf5759c0b45f8d95e9c90ee21ea15db333 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 16 Apr 2025 08:43:03 +0100 Subject: [PATCH] Add logging Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/store.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/store.ts b/src/store.ts index 640608fc..5bfb6eab 100644 --- a/src/store.ts +++ b/src/store.ts @@ -102,17 +102,22 @@ class Store extends ElectronStore<{ throw new Error("safeStorage is not available"); } - const credentials = [ - ...(await keytar.findCredentials(LEGACY_KEYTAR_SERVICE)), - ...(await keytar.findCredentials(KEYTAR_SERVICE)), - ]; - for (const cred of credentials) { - console.info("Store migration: writing", cred); - await this.setSecret(cred.account, cred.password); - console.info("Store migration: deleting", cred); - await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, cred.account); + try { + const credentials = [ + ...(await keytar.findCredentials(LEGACY_KEYTAR_SERVICE)), + ...(await keytar.findCredentials(KEYTAR_SERVICE)), + ]; + for (const cred of credentials) { + console.info("Store migration: writing", cred); + await this.setSecret(cred.account, cred.password); + console.info("Store migration: deleting", cred); + await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, cred.account); + } + console.info(`Store migration done: found ${credentials.length} credentials`); + } catch (e) { + console.error("Store migration failed:", e); + throw e; } - console.info(`Store migration done: found ${credentials.length} credentials`); } /**