Fix silently unhandled database exceptions

This commit is contained in:
Mononaut
2023-11-14 05:00:05 +00:00
parent cbe1ec4e72
commit 1ae34e069c
4 changed files with 36 additions and 10 deletions

View File

@@ -55,14 +55,20 @@ import { execSync } from 'child_process';
}).then(result => {
resolve(result);
}).catch(error => {
logger.debug(`database query "${query.slice(0, 100)}" failed!`);
reject(error);
}).finally(() => {
clearTimeout(timer);
});
});
} else {
const pool = await this.getPool();
return pool.query(query, params);
try {
const pool = await this.getPool();
return pool.query(query, params);
} catch (e) {
logger.debug(`database query "${query.slice(0, 100)}" failed!`);
throw e;
}
}
}