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.
This commit is contained in:
Onur
2024-02-16 02:18:29 +03:00
committed by GitHub
parent e73bc517a8
commit 70c280ca57

View File

@@ -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