From cdb6c425e5b0d41a2008675f7d0fc623986afd00 Mon Sep 17 00:00:00 2001 From: Levi Yan Date: Tue, 15 Oct 2024 17:13:58 +0800 Subject: [PATCH] refactor: add error processing for first connecting remote container --- src/home.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/home.ts b/src/home.ts index 42a39ee..ea63a25 100644 --- a/src/home.ts +++ b/src/home.ts @@ -32,11 +32,13 @@ export default class DSHome { switch (message.command) { case 'firstOpenRemoteFolder': await this.remoteContainer.firstConnect(message.host, message.username, message.password, message.port) - .then((result) => { - if (result === 'success') { - // only success then open folder - this.remoteContainer.openRemoteFolder(message.host, message.path); - } + .then((_res) => { + if (_res == 'success') { + // only success then open folder + this.remoteContainer.openRemoteFolder(message.host, message.path); + } + }).catch(error => { + console.error(`Failed to connect ${message.host}: `, error) }) break; case 'openRemoteFolder':