From ecdcc0b522a0524fc907a2f5b7f702d9073bd37f Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 24 Dec 2020 09:06:43 +0100 Subject: [PATCH] :bug: Fix issue that DB init errors did not get caught #1269 --- packages/cli/commands/start.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/cli/commands/start.ts b/packages/cli/commands/start.ts index d6e16b7cb3..b6f0a39b3e 100644 --- a/packages/cli/commands/start.ts +++ b/packages/cli/commands/start.ts @@ -121,10 +121,16 @@ export class Start extends Command { const { flags } = this.parse(Start); // Wrap that the process does not close but we can still use async - (async () => { + await (async () => { try { // Start directly with the init of the database to improve startup time - const startDbInitPromise = Db.init(); + const startDbInitPromise = Db.init().catch(error => { + console.error(`There was an error initializing DB: ${error.message}`); + + processExistCode = 1; + // @ts-ignore + process.emit('SIGINT'); + }); // Make sure the settings exist const userSettings = await UserSettings.prepareUserSettings();