Add unhandled rejection handler
This commit is contained in:
parent
005f28bd5a
commit
d89f167517
10
index.js
10
index.js
|
@ -96,6 +96,16 @@ client.on("messageCreate", async (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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue