You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to catch the error of connection to automatically try to reconnect if something happen on the network.
Once connected and if I disconnect from the network, an error is thrown like this after a few seconds:
node_modules\ssh2\lib\client.js:999
throw new Error('Not connected');
^
Error: Not connected
at Client.forwardOut (node_modules\ssh2\lib\client.js:999:11)
at Server.<anonymous> (node_modules\node-ssh-forward\dist\Connection.js:185:28)
at Server.emit (events.js:315:20)
at TCP.onconnection (net.js:1555:8)
However it is not detected by the try,catch block around the connection.
export async function main() {
try {
let sshConnection = new SSHConnection(options);
let res = await sshConnection.forward({
fromPort: fp,
toPort: tp,
});
console.log('connected',res);
} catch(err){
console.log('got an error, trying to restart connection',err);
main();
}
}
How could I detect this properly without stopping the process?
The text was updated successfully, but these errors were encountered:
I try to catch the error of connection to automatically try to reconnect if something happen on the network.
Once connected and if I disconnect from the network, an error is thrown like this after a few seconds:
However it is not detected by the try,catch block around the connection.
How could I detect this properly without stopping the process?
The text was updated successfully, but these errors were encountered: