Skip to content

Commit

Permalink
fix: log and exit on unhandled promise rejection (#670)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
bchrobot authored May 20, 2020
1 parent 663e6a6 commit 4eea58c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ import { r } from "./models";
import { getRunner } from "./worker";

process.on("uncaughtException", ex => {
logger.error("uncaughtException", ex);
logger.error("uncaughtException: ", ex);
process.exit(1);
});

process.on("unhandledRejection", err => {
logger.error("unhandledRejection: ", err);
process.exit(1);
});

Expand Down

0 comments on commit 4eea58c

Please sign in to comment.