server: Exit on unhandled Promise rejection

This commit is contained in:
Richard Hansen 2020-12-14 20:45:12 -05:00 committed by John McLear
parent 0ad0160b7c
commit 86ceb2b610

View file

@ -77,6 +77,9 @@ exports.start = async () => {
}
process.on('uncaughtException', exports.exit);
// As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; });
/*
* Connect graceful shutdown with sigint and uncaught exception