MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / uncaughtHandler

Function uncaughtHandler

app.ts:55–64  ·  view source on GitHub ↗
(err: Error, origin: NodeJS.UncaughtExceptionOrigin)

Source from the content-addressed store, hash-verified

53}
54
55function uncaughtHandler(err: Error, origin: NodeJS.UncaughtExceptionOrigin) {
56 logger.error(`stopping process: Uncaught exception (origin: ${origin}):`, err);
57 // A process with live server listeners never exits "naturally": after an uncaught exception we'd
58 // limp on in an undefined state (#8811). Exit after a short delay so winston can flush its
59 // transports (calling `process.exit()` immediately may lose log lines, see
60 // https://github.com/winstonjs/winston/issues/1504#issuecomment-1033087411), and let the load
61 // balancer replace the instance.
62 process.exitCode = 1;
63 setTimeout(() => process.exit(1), 1000);
64}
65
66// Parse command line arguments
67const appArgs = parseArgsToAppArguments(process.argv);

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
exitMethod · 0.80

Tested by

no test coverage detected