From 9e81118cf5901d4141d31433fce63f1ff68431d8 Mon Sep 17 00:00:00 2001 From: Chad Doty Date: Thu, 26 Feb 2026 02:05:21 -0500 Subject: [PATCH] more crash protection --- index.js | 19 +++++++++++++++++++ package-lock.json | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 36bc6ee..304edbf 100644 --- a/index.js +++ b/index.js @@ -57,4 +57,23 @@ client.on(Events.GuildMemberAdd, async (member) => { }); // Log in +// Catch library/client errors to prevent unhandled 'error' events from crashing the process +client.on('error', (err) => { + console.error('Client error:', err); +}); + +// Some libraries emit shard-specific errors — log them for diagnostics +client.on('shardError', (err) => { + console.error('Shard error:', err); +}); + +// Global handlers to capture unexpected problems and provide diagnostics +process.on('uncaughtException', (err) => { + console.error('Uncaught exception:', err); +}); + +process.on('unhandledRejection', (reason, promise) => { + console.error('Unhandled Rejection at:', promise, 'reason:', reason); +}); + client.login(BOT_TOKEN); diff --git a/package-lock.json b/package-lock.json index 6463c49..ad57d9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "ecstest1", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ecstest1", - "version": "1.0.0", - "license": "ISC", + "version": "1.0.1", + "license": "MIT", "dependencies": { "@fluxerjs/core": "^1.2.2", "dotenv": "^17.3.1"