Add unhandled rejection handler

This commit is contained in:
Christopher Cookman 2025-01-18 22:43:18 -07:00
parent 005f28bd5a
commit d89f167517

View file

@ -96,6 +96,16 @@ client.on("messageCreate", async (message) => {
global.dmHandlers[message.author.id](message); global.dmHandlers[message.author.id](message);
}); });
// Global error handling for unhandled promise rejections and uncaught exceptions
process.on('unhandledRejection', (reason, promise) => {
log.error('Unhandled Rejection at:', promise, 'reason:', reason);
// Application specific logging, throwing an error, or other logic here
});
process.on('uncaughtException', (error) => {
log.error('Uncaught Exception thrown:', error);
// Application specific logging, throwing an error, or other logic here
});
const port = process.env.SERVER_PORT || 3000; const port = process.env.SERVER_PORT || 3000;