fix: prevent backend from crashing on unhandled errors to diagnose restart loop

This commit is contained in:
2026-09-23 01:10:32 +05:30
parent d673919fec
commit 862c045176
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -4,6 +4,13 @@ const dotenv = require('dotenv');
const connectDB = require('./config/db');
const path = require('path');
process.on('uncaughtException', err => {
console.error('Uncaught Exception:', err);
});
process.on('unhandledRejection', err => {
console.error('Unhandled Rejection:', err);
});
// Load env vars
dotenv.config();