Skip to content

Commit

Permalink
feat: Node process exits with error code 1 on uncaught exception to a…
Browse files Browse the repository at this point in the history
…llow custom uncaught exception handling (#8894)

BREAKING CHANGE: Node process now exits with code 1 on uncaught exceptions, enabling custom handlers that were blocked by Parse Server's default behavior of re-throwing errors. This change may lead to automatic process restarts by the environment, unlike before.
  • Loading branch information
onurhanife committed Feb 15, 2024
1 parent e73bc51 commit 70c280c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ParseServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,15 @@ class ParseServer {
process.stderr.write(`Unable to listen on port ${err.port}. The port is already in use.`);
process.exit(0);
} else {
throw err;
if (err.message) {
process.stderr.write('An uncaught exception occurred: ' + err.message);
}
if (err.stack) {
process.stderr.write('Stack Trace:\n' + err.stack);
} else {
process.stderr.write(err);
}
process.exit(1);
}
});
// verify the server url after a 'mount' event is received
Expand Down

0 comments on commit 70c280c

Please sign in to comment.