refactor: add error processing for first connecting remote container

This commit is contained in:
Levi Yan
2024-10-15 17:13:58 +08:00
parent 2b0875d0a8
commit cdb6c425e5

View File

@@ -32,11 +32,13 @@ export default class DSHome {
switch (message.command) { switch (message.command) {
case 'firstOpenRemoteFolder': case 'firstOpenRemoteFolder':
await this.remoteContainer.firstConnect(message.host, message.username, message.password, message.port) await this.remoteContainer.firstConnect(message.host, message.username, message.password, message.port)
.then((result) => { .then((_res) => {
if (result === 'success') { if (_res == 'success') {
// only success then open folder // only success then open folder
this.remoteContainer.openRemoteFolder(message.host, message.path); this.remoteContainer.openRemoteFolder(message.host, message.path);
} }
}).catch(error => {
console.error(`Failed to connect ${message.host}: `, error)
}) })
break; break;
case 'openRemoteFolder': case 'openRemoteFolder':