SSH - handle SSH error

This commit is contained in:
SPRINX0\prochazka
2025-01-06 08:24:14 +01:00
parent aff282d31e
commit 053ba471a6
2 changed files with 6 additions and 1 deletions

View File

@@ -43,19 +43,25 @@ function callForwardProcess(connection, tunnelConfig, tunnelCacheKey) {
logger.error(extractErrorLogData(err), 'Error connecting SSH');
}
return new Promise((resolve, reject) => {
let promiseHandled = false;
subprocess.on('message', resp => {
// @ts-ignore
const { msgtype, errorMessage } = resp;
if (msgtype == 'connected') {
resolve(subprocess);
promiseHandled = true;
}
if (msgtype == 'error') {
reject(new Error(errorMessage));
promiseHandled = true;
}
});
subprocess.on('exit', code => {
logger.info('SSH forward process exited');
delete sshTunnelCache[tunnelCacheKey];
if (!promiseHandled) {
reject(new Error('SSH forward process exited, try to change "Local host address for SSH connections" in Settings/Connections'));
}
});
});
}

View File

@@ -211,7 +211,6 @@ ORDER BY
{ value: '127.0.0.1', label: '127.0.0.1 (IPv4)' },
{ value: '::1', label: '::1 (IPv6)' },
{ value: 'localhost', label: 'localhost (domain name)' },
{ value: 'testerror', label: 'testerror' },
]}
/>