Skip to content

Commit 5e1ad87

Browse files
committed
fix: add error logging to pw migration
Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
1 parent d72403d commit 5e1ad87

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/util/credentialManager.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,21 @@ export class CredentialManager {
142142
}
143143

144144
const storageKey = getStorageKey(`${config.protocol}://${config.serverAddress}:${config.port}`, config.user);
145-
await this.storeCredentials(storageKey, config.user, config.password);
146-
logger.debug(`Migrated credentials for ${config.user}@${storageKey} to secure storage`);
147-
delete config.password;
148-
await launchConfig.update("configurations", configurations, vscode.ConfigurationTarget.WorkspaceFolder);
145+
146+
try {
147+
await this.storeCredentials(storageKey, config.user, config.password);
148+
const storedPassword = await this.context.secrets.get(storageKey);
149+
if (storedPassword !== config.password) {
150+
throw new Error("Failed to verify stored password");
151+
}
152+
153+
logger.debug(`Migrated credentials for ${config.user}@${storageKey} to secure storage`);
154+
delete config.password;
155+
await launchConfig.update("configurations", configurations, vscode.ConfigurationTarget.WorkspaceFolder);
156+
} catch (error) {
157+
logger.error(`Failed to migrate credentials for ${config.user}@${storageKey}: ${error}`);
158+
throw error;
159+
}
149160
}
150161

151162
async migrateExistingCredentials(): Promise<void> {

0 commit comments

Comments
 (0)