From 552991271f07802ef3c60f56e08f59a60b5cfa15 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 20 Jun 2021 17:01:24 +0200 Subject: [PATCH] error handling --- .../editConnectionModal.component.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/terminus-ssh/src/components/editConnectionModal.component.ts b/terminus-ssh/src/components/editConnectionModal.component.ts index 9b6b6562..9c320342 100644 --- a/terminus-ssh/src/components/editConnectionModal.component.ts +++ b/terminus-ssh/src/components/editConnectionModal.component.ts @@ -64,14 +64,6 @@ export class EditConnectionModalComponent { ) async ngOnInit () { - this.hasSavedPassword = !!await this.passwordStorage.loadPassword(this.connection) - this.connection.algorithms = this.connection.algorithms ?? {} - this.connection.scripts = this.connection.scripts ?? [] - this.connection.auth = this.connection.auth ?? null - this.connection.privateKeys ??= [] - - this.useProxyCommand = !!this.connection.proxyCommand - for (const k of Object.values(SSHAlgorithmType)) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!this.connection.algorithms[k]) { @@ -83,6 +75,18 @@ export class EditConnectionModalComponent { this.algorithms[k][alg] = true } } + + this.connection.algorithms = this.connection.algorithms ?? {} + this.connection.scripts = this.connection.scripts ?? [] + this.connection.auth = this.connection.auth ?? null + this.connection.privateKeys ??= [] + + this.useProxyCommand = !!this.connection.proxyCommand + try { + this.hasSavedPassword = !!await this.passwordStorage.loadPassword(this.connection) + } catch (e) { + console.error('Could not check for saved password', e) + } } async setPassword () {