handle errors when sending to subprocess #458

This commit is contained in:
Jan Prochazka
2023-01-23 19:28:05 +01:00
parent d60687485b
commit 80e8b210be
5 changed files with 66 additions and 13 deletions

View File

@@ -1,11 +1,17 @@
const { getLogger } = require('dbgate-tools');
const uuidv1 = require('uuid/v1');
const { getSshTunnel } = require('./sshTunnel');
const logger = getLogger('sshTunnelProxy');
const dispatchedMessages = {};
async function handleGetSshTunnelRequest({ msgid, connection }, subprocess) {
const response = await getSshTunnel(connection);
subprocess.send({ msgtype: 'getsshtunnel-response', msgid, response });
try {
subprocess.send({ msgtype: 'getsshtunnel-response', msgid, response });
} catch (err) {
logger.error({ err }, 'Error sending to SSH tunnel');
}
}
function handleGetSshTunnelResponse({ msgid, response }, subprocess) {