mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 19:43:58 +00:00
reporting SSH tunnel errors
This commit is contained in:
@@ -3,7 +3,7 @@ const platformInfo = require('../utility/platformInfo');
|
|||||||
const childProcessChecker = require('../utility/childProcessChecker');
|
const childProcessChecker = require('../utility/childProcessChecker');
|
||||||
const { handleProcessCommunication } = require('../utility/processComm');
|
const { handleProcessCommunication } = require('../utility/processComm');
|
||||||
const { SSHConnection } = require('../utility/SSHConnection');
|
const { SSHConnection } = require('../utility/SSHConnection');
|
||||||
const { getLogger, extractErrorLogData } = require('dbgate-tools');
|
const { getLogger, extractErrorLogData, extractErrorMessage } = require('dbgate-tools');
|
||||||
|
|
||||||
const logger = getLogger('sshProcess');
|
const logger = getLogger('sshProcess');
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ async function handleStart({ connection, tunnelConfig }) {
|
|||||||
msgtype: 'error',
|
msgtype: 'error',
|
||||||
connection,
|
connection,
|
||||||
tunnelConfig,
|
tunnelConfig,
|
||||||
errorMessage: err.message,
|
errorMessage: extractErrorMessage(err.message),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function callForwardProcess(connection, tunnelConfig, tunnelCacheKey) {
|
|||||||
resolve(subprocess);
|
resolve(subprocess);
|
||||||
}
|
}
|
||||||
if (msgtype == 'error') {
|
if (msgtype == 'error') {
|
||||||
reject(errorMessage);
|
reject(new Error(errorMessage));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
subprocess.on('exit', code => {
|
subprocess.on('exit', code => {
|
||||||
@@ -91,6 +91,7 @@ async function getSshTunnel(connection) {
|
|||||||
};
|
};
|
||||||
return sshTunnelCache[tunnelCacheKey];
|
return sshTunnelCache[tunnelCacheKey];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
logger.error(extractErrorLogData(err), 'Error creating SSH tunnel:');
|
||||||
// error is not cached
|
// error is not cached
|
||||||
return {
|
return {
|
||||||
state: 'error',
|
state: 'error',
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ function getConnectionLabelCore(connection, { allowExplicitDatabase = true } = {
|
|||||||
if (connection.databaseFile) {
|
if (connection.databaseFile) {
|
||||||
return getDatabaseFileLabel(connection.databaseFile);
|
return getDatabaseFileLabel(connection.databaseFile);
|
||||||
}
|
}
|
||||||
|
if (connection.useSshTunnel && connection.server == 'localhost') {
|
||||||
|
return `${connection.sshHost} - SSH`;
|
||||||
|
}
|
||||||
if (connection.server) {
|
if (connection.server) {
|
||||||
return connection.server;
|
return connection.server;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user