server for my chess game
Diffstat (limited to 'src/pg.js')
-rw-r--r--src/pg.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pg.js b/src/pg.js
index a2ac98c..b6a5a0c 100644
--- a/src/pg.js
+++ b/src/pg.js
@@ -14,7 +14,7 @@ pool.on("error", (err) => {
* Runs a SQL command on the database
*
* @param {String} command The command to run
- * @returns {(undefined|Object)} result
+ * @returns {Promise<(undefined|Object)>} result
*/
export async function command(command) {
let client;
@@ -25,6 +25,6 @@ export async function command(command) {
} catch (err) {
console.error("database: err:", err.stack);
} finally {
- client.release();
+ if (client) client.release();
}
}