Skip to content

Commit 4eea58c

Browse files
authoredMay 20, 2020
fix: log and exit on unhandled promise rejection (#670)
This fixes the issue of pods not restarting on database connection errors. It will also provide much better visibility into a variety of other unhandled promise rejections we get in Spoke. Ref: nodejs/node#9523 (comment)
1 parent 663e6a6 commit 4eea58c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/server/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ import { r } from "./models";
2828
import { getRunner } from "./worker";
2929

3030
process.on("uncaughtException", ex => {
31-
logger.error("uncaughtException", ex);
31+
logger.error("uncaughtException: ", ex);
32+
process.exit(1);
33+
});
34+
35+
process.on("unhandledRejection", err => {
36+
logger.error("unhandledRejection: ", err);
3237
process.exit(1);
3338
});
3439

0 commit comments

Comments
 (0)
Please sign in to comment.