🥅 Catch SSH connect errors

dev
KaKi87 2 years ago
parent f26e4215fe
commit c6843db06f

@ -33,19 +33,31 @@ module.exports = {
client.on('end', () => prevClient.end());
prevClient.forwardOut('127.0.0.1', 12345 + i, address, port, (error, prevClientStream) => {
if(error) onError(error);
try {
client.connect({
sock: prevClientStream,
username,
password
});
}
catch(error){
onError(error);
}
});
}
else {
try {
client.connect({
sock: prevClientStream,
host: address,
port,
username,
password
});
});
}
catch(error){
onError(error);
}
}
else client.connect({
host: address,
port,
username,
password
});
});
}
})();

Loading…
Cancel
Save