Skip to content

Commit

Permalink
Ensure that NodeJS fails on unhandled errors (#3092)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Nov 7, 2024
1 parent 815f2ef commit 414dca5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/test/Common/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ class ControllerHelper {

(async function () {
try {
process.on("unhandledRejection", (reason, promise) => {
console.error("Unhandled Rejection at:", promise, "reason:", reason);
process.exit(1);
});

process.on("uncaughtException", err => {
console.error("Uncaught Exception:", err);
process.exit(1);
});

const path = process.argv[2];
const name = process.argv[3];
const module = await import(path);
Expand Down

0 comments on commit 414dca5

Please sign in to comment.