fix: don't exit the script when exceptions occur

This commit is contained in:
James Murdza 2024-09-30 02:55:22 -07:00
parent 7a00d24ab9
commit 13be78dee8

View File

@ -39,6 +39,18 @@ import {
saveFileRL, saveFileRL,
} from "./ratelimit"; } from "./ratelimit";
process.on('uncaughtException', (error) => {
console.error('Uncaught Exception:', error);
// Do not exit the process
// You can add additional logging or recovery logic here
});
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
// Do not exit the process
// You can also handle the rejected promise here if needed
});
dotenv.config(); dotenv.config();
const app: Express = express(); const app: Express = express();