From 47d746ea07ea9ccea97c0698b99c5432107a513f Mon Sep 17 00:00:00 2001 From: "beetles-ai[bot]" <221859081+beetles-ai[bot]@users.noreply.github.com> Date: Sat, 4 Oct 2025 13:00:57 +0000 Subject: [PATCH] Patch for db/db.js --- db/db.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/db/db.js b/db/db.js index e38e903..694a77b 100644 --- a/db/db.js +++ b/db/db.js @@ -12,14 +12,15 @@ const connectedToDb = async () => { return; } - try { - await mongoose.connect(MONGO_URI, { - dbName: "leadllyQuestions", - }); - console.log("Connected to db"); - } catch (error) { - console.error("mongo error =========>", error); - } +try { +await mongoose.connect(MONGO_URI, { +dbName: "leadllyQuestions", +}); +console.log("Connected to db"); +} catch (error) { +console.error("Database connection error:", error); +process.exit(1); // Exit the application if the database connection fails +} }; export default connectedToDb;