Browse Source

fix: improve db error reporting for pg

pull/1344/head
NGPixel 4 years ago
parent
commit
3092615c5e
1 changed files with 6 additions and 1 deletions
  1. 7
      server/core/db.js

7
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 {

Loading…
Cancel
Save