Error Handling in Async Code
What Node.js error handling pattern is shown?
process.on('uncaughtException', (error) => {
logger.fatal(error);
// Perform cleanup
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
logger.error('Unhandled Rejection at:', promise, 'reason:', reason);
// Optionally crash on unhandled rejections
throw reason;
});