Browse Source

Placate the linter

GitOrigin-RevId: 064d796a5c3c49cfdacee5cf1a461d38f08425b3
andrew rumble 2 years ago
parent
commit
d4cc50bc21
1 changed files with 10 additions and 3 deletions
  1. 10 3
      services/web/app/src/infrastructure/Mongoose.js

+ 10 - 3
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