From 0612f23b3647a9b89c401d69820618e9e2f9b687 Mon Sep 17 00:00:00 2001 From: Noah Zalev Date: Sat, 24 Apr 2021 17:22:39 -0400 Subject: [PATCH] Bail if unable to connect to db --- db.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db.js b/db.js index b5f2d754..cbaec325 100644 --- a/db.js +++ b/db.js @@ -467,7 +467,10 @@ module.exports.CreateDB = function (parent, func) { // Set the default database for the rest of this connections lifetime var useDatabase = 'USE ' + dbname; sqlDbQuery(useDatabase, null, function (err, docs) { - if (err != null) { console.log(err); parent.debug('db', 'ERROR: ' + useDatabase + ': ' + err); } + if (err != null) { + console.log("Unable to connect to database: " + err); + process.exit(); + } if (err == null) { parent.debug('db', 'Checking tables...'); sqlDbBatchExec([