Q62: How do you handle unhandled promise rejections in Node.js?
Handle unhandled promise rejections using process.on('unhandledRejection', callback). In modern Node.js versions, unhandled rejections terminate the process with a non-zero exit code by default.
Key Takeaways
- Failing to catch promise rejections triggers unhandled rejections.
- Process listener enables central logging and clean teardown.
Knowledge Check
Which process event fires when a Promise is rejected without a .catch() block?