From a840f6ded3a30cfdb6ecb6548fad7786b9196f17 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Thu, 20 Jun 2024 23:14:26 -0500 Subject: [PATCH] Crash prevention --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ebb7127..b861892 100644 --- a/index.js +++ b/index.js @@ -170,4 +170,12 @@ wsServer.on("connection", function connection(socket) { server.listen(PORT, function () { console.log("API & Websocket now on port: " + PORT) -}) \ No newline at end of file +}) + +process.on('uncaughtException', (err, origin) => { + fs.writeSync( + process.stderr.fd, + `Caught exception: ${err}\n` + + `Exception origin: ${origin}`, + ); + }); \ No newline at end of file