mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
SYNC: handle subprocess errors
This commit is contained in:
committed by
Diflow
parent
4b3c0466eb
commit
14b47a929f
@@ -142,6 +142,11 @@ module.exports = {
|
|||||||
if (newOpened.disconnected) return;
|
if (newOpened.disconnected) return;
|
||||||
this.close(conid, database, false);
|
this.close(conid, database, false);
|
||||||
});
|
});
|
||||||
|
subprocess.on('error', err => {
|
||||||
|
logger.error(extractErrorLogData(err), 'Error in database connection subprocess');
|
||||||
|
if (newOpened.disconnected) return;
|
||||||
|
this.close(conid, database, false);
|
||||||
|
});
|
||||||
|
|
||||||
subprocess.send({
|
subprocess.send({
|
||||||
msgtype: 'connect',
|
msgtype: 'connect',
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ module.exports = {
|
|||||||
if (newOpened.disconnected) return;
|
if (newOpened.disconnected) return;
|
||||||
this.close(conid, false);
|
this.close(conid, false);
|
||||||
});
|
});
|
||||||
|
subprocess.on('error', err => {
|
||||||
|
logger.error(extractErrorLogData(err), 'Error in server connection subprocess');
|
||||||
|
if (newOpened.disconnected) return;
|
||||||
|
this.close(conid, false);
|
||||||
|
});
|
||||||
subprocess.send({ msgtype: 'connect', ...connection, globalSettings: await config.getSettings() });
|
subprocess.send({ msgtype: 'connect', ...connection, globalSettings: await config.getSettings() });
|
||||||
return newOpened;
|
return newOpened;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ class DatastoreProxy {
|
|||||||
// if (this.disconnected) return;
|
// if (this.disconnected) return;
|
||||||
this.subprocess = null;
|
this.subprocess = null;
|
||||||
});
|
});
|
||||||
|
this.subprocess.on('error', err => {
|
||||||
|
logger.error(extractErrorLogData(err), 'Error in data store subprocess');
|
||||||
|
this.subprocess = null;
|
||||||
|
});
|
||||||
this.subprocess.send({ msgtype: 'open', file: this.file });
|
this.subprocess.send({ msgtype: 'open', file: this.file });
|
||||||
}
|
}
|
||||||
return this.subprocess;
|
return this.subprocess;
|
||||||
|
|||||||
@@ -57,10 +57,21 @@ function callForwardProcess(connection, tunnelConfig, tunnelCacheKey) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
subprocess.on('exit', code => {
|
subprocess.on('exit', code => {
|
||||||
logger.info('SSH forward process exited');
|
logger.info(`SSH forward process exited with code ${code}`);
|
||||||
delete sshTunnelCache[tunnelCacheKey];
|
delete sshTunnelCache[tunnelCacheKey];
|
||||||
if (!promiseHandled) {
|
if (!promiseHandled) {
|
||||||
reject(new Error('SSH forward process exited, try to change "Local host address for SSH connections" in Settings/Connections'));
|
reject(
|
||||||
|
new Error(
|
||||||
|
'SSH forward process exited, try to change "Local host address for SSH connections" in Settings/Connections'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subprocess.on('error', error => {
|
||||||
|
logger.error(extractErrorLogData(error), 'SSH forward process error');
|
||||||
|
delete sshTunnelCache[tunnelCacheKey];
|
||||||
|
if (!promiseHandled) {
|
||||||
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user