Skip to content

Commit

Permalink
enh: add global handler for uncaught exceptions/rejections (#2280)
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanierh authored Oct 26, 2023
1 parent 38fd2b1 commit 775f5f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions connectors/src/api_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ import logger from "@connectors/logger/logger";
import { authMiddleware } from "@connectors/middleware/auth";

export function startServer(port: number) {
process.on("unhandledRejection", (reason, promise) => {
logger.error("Unhandled Rejection at:", promise, "reason:", reason);
});

process.on("uncaughtException", (error) => {
logger.error("Uncaught Exception thrown", error);
});

const app = express();

// for health check -- doesn't go through auth middleware
Expand Down

0 comments on commit 775f5f3

Please sign in to comment.