From 176f2ce7b9ff57671433e3b0dfdf88a162f088b2 Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 27 Oct 2022 01:30:59 -0400 Subject: [PATCH] Kill if db can't connect --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index e34882a..88c6562 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,13 @@ async function init() { process.exit(1); }); - await initDb(); + try { + await initDb(); + } catch (e) { + Logger.error(`Init Db: ${e}`); + process.exit(1); + } + // edge case clause for creating compatible .db files, do not enable if (config.mode === "init-db-and-exit") process.exit(0); // do not enable init-db-only mode for usage. @@ -27,4 +33,4 @@ async function init() { }).setTimeout(15000); } -init().catch((err) => Logger.error(err)); \ No newline at end of file +init().catch((err) => Logger.error(`Index.js: ${err}`)); \ No newline at end of file