mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 20:53:39 -05:00
add uncaughtException handler
This commit is contained in:
parent
237dd8d3e2
commit
fc11574698
2 changed files with 11 additions and 0 deletions
|
@ -339,6 +339,15 @@ const loadHttpPort = Settings.internal.load_balancer_agent.local_port
|
||||||
|
|
||||||
if (!module.parent) {
|
if (!module.parent) {
|
||||||
// Called directly
|
// Called directly
|
||||||
|
|
||||||
|
// handle uncaught exceptions when running in production
|
||||||
|
if (Settings.catchErrors) {
|
||||||
|
process.removeAllListeners('uncaughtException')
|
||||||
|
process.on('uncaughtException', (error) =>
|
||||||
|
logger.error({ err: error }, 'uncaughtException')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
app.listen(port, host, (error) => {
|
app.listen(port, host, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
logger.fatal({ error }, `Error starting CLSI on ${host}:${port}`)
|
logger.fatal({ error }, `Error starting CLSI on ${host}:${port}`)
|
||||||
|
|
|
@ -25,6 +25,8 @@ module.exports = {
|
||||||
processLifespanLimitMs:
|
processLifespanLimitMs:
|
||||||
parseInt(process.env.PROCESS_LIFE_SPAN_LIMIT_MS) || 60 * 60 * 24 * 1000 * 2,
|
parseInt(process.env.PROCESS_LIFE_SPAN_LIMIT_MS) || 60 * 60 * 24 * 1000 * 2,
|
||||||
|
|
||||||
|
catchErrors: process.env.CATCH_ERRORS === 'true',
|
||||||
|
|
||||||
path: {
|
path: {
|
||||||
compilesDir: Path.resolve(__dirname, '../compiles'),
|
compilesDir: Path.resolve(__dirname, '../compiles'),
|
||||||
outputDir: Path.resolve(__dirname, '../output'),
|
outputDir: Path.resolve(__dirname, '../output'),
|
||||||
|
|
Loading…
Reference in a new issue