From bcb6963c35bc739512682bda1a356017d9e2320b Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 5 Jan 2019 15:19:02 +0100 Subject: [PATCH] show ssh connection errors --- terminus-ssh/src/services/ssh.service.ts | 32 +++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/terminus-ssh/src/services/ssh.service.ts b/terminus-ssh/src/services/ssh.service.ts index 19405f20..437afae2 100644 --- a/terminus-ssh/src/services/ssh.service.ts +++ b/terminus-ssh/src/services/ssh.service.ts @@ -117,20 +117,24 @@ export class SSHService { agent = process.env.SSH_AUTH_SOCK } - ssh.connect({ - host: connection.host, - port: connection.port || 22, - username: connection.user, - password: connection.privateKey ? undefined : '', - privateKey, - passphrase: privateKeyPassphrase, - tryKeyboard: true, - agent, - agentForward: !!agent, - keepaliveInterval: connection.keepaliveInterval, - keepaliveCountMax: connection.keepaliveCountMax, - readyTimeout: connection.readyTimeout, - }) + try { + ssh.connect({ + host: connection.host, + port: connection.port || 22, + username: connection.user, + password: connection.privateKey ? undefined : '', + privateKey, + passphrase: privateKeyPassphrase, + tryKeyboard: true, + agent, + agentForward: !!agent, + keepaliveInterval: connection.keepaliveInterval, + keepaliveCountMax: connection.keepaliveCountMax, + readyTimeout: connection.readyTimeout, + }) + } catch (e) { + this.toastr.error(e.message) + } let keychainPasswordUsed = false