From d4cc50bc21c4bf0802ff0bada4234ef53f3d4254 Mon Sep 17 00:00:00 2001 From: andrew rumble Date: Fri, 2 Aug 2024 18:41:39 +0100 Subject: [PATCH] Placate the linter GitOrigin-RevId: 064d796a5c3c49cfdacee5cf1a461d38f08425b3 --- services/web/app/src/infrastructure/Mongoose.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/infrastructure/Mongoose.js b/services/web/app/src/infrastructure/Mongoose.js index 5871c49925..48f042836b 100644 --- a/services/web/app/src/infrastructure/Mongoose.js +++ b/services/web/app/src/infrastructure/Mongoose.js @@ -21,9 +21,16 @@ const connectionPromise = mongoose.connect( Settings.mongo.options ) -connectionPromise.then(mongooseInstance => { - Metrics.mongodb.monitor(mongooseInstance.connection.client) -}) +connectionPromise + .then(mongooseInstance => { + Metrics.mongodb.monitor(mongooseInstance.connection.client) + }) + .catch(error => { + logger.error( + { error }, + 'Failed to connect to MongoDB - cannot set up monitoring' + ) + }) addConnectionDrainer('mongoose', async () => { await connectionPromise