Browse Source

Merge pull request #94 from overleaf/spd-unhandled-errors

Write to error log on unhandled rejection/exception
Simon Detheridge 6 năm trước cách đây
mục cha
commit
00d949ba26
1 tập tin đã thay đổi với 9 bổ sung và 0 xóa
  1. 9 0
      services/filestore/app.js

+ 9 - 0
services/filestore/app.js

@@ -156,4 +156,13 @@ if (!module.parent) {
   })
 }
 
+process
+  .on('unhandledRejection', (reason, p) => {
+    logger.err(reason, 'Unhandled Rejection at Promise', p)
+  })
+  .on('uncaughtException', err => {
+    logger.err(err, 'Uncaught Exception thrown')
+    process.exit(1)
+  })
+
 module.exports = app