From 6e19a650d2b7219f3575f544b2c36581b221f4c8 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Thu, 27 Feb 2020 10:33:48 +0000 Subject: [PATCH] Write to error log on unhandled rejection/exception --- services/filestore/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/filestore/app.js b/services/filestore/app.js index e48e8ae3c8..278997b9aa 100644 --- a/services/filestore/app.js +++ b/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