From 4f24f16e27d942b063c945dde55b902572b7dee7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 24 Aug 2020 11:33:59 +0200 Subject: Better error message on postgresql connection err --- server/initializers/database.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/initializers') diff --git a/server/initializers/database.ts b/server/initializers/database.ts index 8ce32f6fa..5cf5765f6 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts @@ -75,6 +75,14 @@ const sequelizeTypescript = new SequelizeTypescript({ } }) +sequelizeTypescript.authenticate() + .then(() => logger.debug('Connection to PostgreSQL has been established successfully.')) + .catch(err => { + + logger.error('Unable to connect to PostgreSQL database.', { err }) + process.exit(-1) + }) + async function initDatabaseModels (silent: boolean) { sequelizeTypescript.addModels([ ApplicationModel, -- cgit v1.2.3