From 66324fe1ca35d9f1760e8245d8f426600f3f5964 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 24 Sep 2021 14:42:07 +0200 Subject: [PATCH] fix connection error for case database not running --- backend/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index c138deba7..18ac9d9c1 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -26,8 +26,11 @@ const DB_VERSION = '0001-init_db' async function main() { // open mysql connection - const con = await connection() - if (!con.isConnected) { + let con = null + try { + con = await connection() + } catch (error) {} + if (!con || !con.isConnected) { throw new Error(`Couldn't open connection to database`) }