From 3092615c5ea7dd39f0e84eccaddbe43a3bc271e9 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Mon, 30 Dec 2019 16:45:25 -0500 Subject: [PATCH] fix: improve db error reporting for pg --- server/core/db.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/core/db.js b/server/core/db.js index 619587b7..bab4ffd4 100644 --- a/server/core/db.js +++ b/server/core/db.js @@ -138,7 +138,11 @@ module.exports = { WIKI.logger.info('Database Connection Successful [ OK ]') } catch (err) { if (conAttempts < 10) { - WIKI.logger.error(`Database Connection Error: ${err.code} ${err.address}:${err.port}`) + if (err.code) { + WIKI.logger.error(`Database Connection Error: ${err.code} ${err.address}:${err.port}`) + } else { + WIKI.logger.error(`Database Connection Error: ${err.message}`) + } WIKI.logger.warn(`Will retry in 3 seconds... [Attempt ${++conAttempts} of 10]`) await new Promise(resolve => setTimeout(resolve, 3000)) await initTasks.connect() @@ -170,6 +174,7 @@ module.exports = { // Perform init tasks + WIKI.logger.info(`Using database driver ${dbClient} for ${WIKI.config.db.type} [ OK ]`) this.onReady = Promise.each(initTasksQueue, t => t()).return(true) return {