Backend: Implement async error handling wrapper and refactor entry and media controllers to use it
This commit is contained in:
1 parent
ad58164df4
commit
4a1d2bc614
8 files changed
+92
-33
No files matched your search
@@ -5,6 +5,19 @@ const sequelize = require('./config/database.js');
|
||||
|
||||
const app = express();
|
||||
|
||||
// Global error handling for unhandled promise rejections
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.log('Unhandled Rejection at:', promise, 'reason:', reason);
|
||||
// Application specific logging, throwing an error, or other logic here
|
||||
});
|
||||
|
||||
// Global error handling for uncaught exceptions
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.log('Uncaught Exception:', error);
|
||||
// Application specific logging, throwing an error, or other logic here
|
||||
process.exit(1); // Exit the process to avoid undefined state
|
||||
});
|
||||
|
||||
const relations = require('./config/relations.js');
|
||||
const sequelizeHooks = require('./config/sequelizeHooks.js');
|
||||
const { initializeData } = require('./config/dataInitializer.js');
|
||||
|
||||
Reference in new issue
Block a user