more crash protection

This commit is contained in:
2026-02-26 02:05:21 -05:00
parent f489de4941
commit 9e81118cf5
2 changed files with 22 additions and 3 deletions

View File

@@ -57,4 +57,23 @@ client.on(Events.GuildMemberAdd, async (member) => {
}); });
// Log in // 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); client.login(BOT_TOKEN);

6
package-lock.json generated
View File

@@ -1,13 +1,13 @@
{ {
"name": "ecstest1", "name": "ecstest1",
"version": "1.0.0", "version": "1.0.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ecstest1", "name": "ecstest1",
"version": "1.0.0", "version": "1.0.1",
"license": "ISC", "license": "MIT",
"dependencies": { "dependencies": {
"@fluxerjs/core": "^1.2.2", "@fluxerjs/core": "^1.2.2",
"dotenv": "^17.3.1" "dotenv": "^17.3.1"