handle disconnected database

This commit is contained in:
Jan Prochazka
2020-05-01 19:50:55 +02:00
parent 024c7ddf21
commit cfc44e4f2f
4 changed files with 64 additions and 4 deletions

View File

@@ -85,6 +85,16 @@ module.exports = {
return res;
},
status_meta: 'get',
async status({ conid, database }) {
const existing = this.opened.find((x) => x.conid == conid && x.database == database);
if (existing) return existing.status;
return {
name: 'error',
message: 'Not connected',
};
},
ping_meta: 'post',
async ping({ conid, database }) {
const existing = this.opened.find((x) => x.conid == conid && x.database == database);