From e8a519353b1b75ed9f65cd3f23d4a95b2b4e5049 Mon Sep 17 00:00:00 2001 From: Wouter-Thys <55975971+Wouter-Thys@users.noreply.github.com> Date: Fri, 8 Jan 2021 22:00:10 +0100 Subject: [PATCH] docker debug --- commands/watchlist.js | 18 +++++++++--------- posts.js | 21 +++++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/commands/watchlist.js b/commands/watchlist.js index d534221..3040f2b 100644 --- a/commands/watchlist.js +++ b/commands/watchlist.js @@ -85,21 +85,21 @@ module.exports = { }); // close the database connection - } - }) - .catch(function (error) { + db.close((err) => { + if (err) { - console.log(error); + return console.error(err.message); - }); - db.close((err) => { - if (err) { + } - return console.error(err.message); + console.log("Close the database connection."); + }); } + }) + .catch(function (error) { - console.log("Close the database connection."); + console.log(error); }); }, diff --git a/posts.js b/posts.js index b202a7f..7e3daa2 100644 --- a/posts.js +++ b/posts.js @@ -83,16 +83,6 @@ module.exports = function () { ); }); }); - db.close((err) => { - if (err) { - - return console.error(err.message); - - } - - console.log("Close the database connection."); - - }); } }) @@ -100,6 +90,17 @@ module.exports = function () { .catch(function (error) { console.log(error); }); + + db.close((err) => { + if (err) { + + return console.error(err.message); + + } + + console.log("Close the database connection."); + + }); executed = true;