Skip to content

Commit 70c280c

Browse files
authored
feat: Node process exits with error code 1 on uncaught exception to allow 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.
1 parent e73bc51 commit 70c280c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ParseServer.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,15 @@ class ParseServer {
244244
process.stderr.write(`Unable to listen on port ${err.port}. The port is already in use.`);
245245
process.exit(0);
246246
} else {
247-
throw err;
247+
if (err.message) {
248+
process.stderr.write('An uncaught exception occurred: ' + err.message);
249+
}
250+
if (err.stack) {
251+
process.stderr.write('Stack Trace:\n' + err.stack);
252+
} else {
253+
process.stderr.write(err);
254+
}
255+
process.exit(1);
248256
}
249257
});
250258
// verify the server url after a 'mount' event is received

0 commit comments

Comments
 (0)