mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 12:26:01 +00:00
better connection error reporting
This commit is contained in:
@@ -71,6 +71,11 @@ module.exports = {
|
||||
handle_error(conid, database, props) {
|
||||
const { error } = props;
|
||||
logger.error(`Error in database connection ${conid}, database ${database}: ${error}`);
|
||||
if (props?.msgid) {
|
||||
const [resolve, reject] = this.requests[props?.msgid];
|
||||
reject(error);
|
||||
delete this.requests[props?.msgid];
|
||||
}
|
||||
},
|
||||
handle_response(conid, database, { msgid, ...response }) {
|
||||
const [resolve, reject] = this.requests[msgid];
|
||||
|
||||
@@ -427,7 +427,11 @@ function start() {
|
||||
await handleMessage(message);
|
||||
} catch (err) {
|
||||
logger.error(extractErrorLogData(err), 'Error in DB connection');
|
||||
process.send({ msgtype: 'error', error: extractErrorMessage(err, 'Error processing message') });
|
||||
process.send({
|
||||
msgtype: 'error',
|
||||
error: extractErrorMessage(err, 'Error processing message'),
|
||||
msgid: message?.msgid,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ module.exports = function useController(app, electron, route, controller) {
|
||||
detail: err.detail,
|
||||
});
|
||||
} else {
|
||||
res.status(500).json({ apiErrorMessage: err.message });
|
||||
res.status(500).json({ apiErrorMessage: (_.isString(err) ? err : err.message) ?? 'Unknown error' });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user