Grokking ExpressJS
Vote

0% completed

​

Process Errors and Health Checks

This handler is meant to make crashes visible, but it makes the process survive them instead:

process.on('unhandledRejection', (reason) => console.log('logged:', reason.message)); Promise.reject(new Error('Database connection lost')); setTimeout(() => console.log('still alive after 500 ms'), 500);
logged: Database connection lost still alive after 500 ms

The process exited with code 0, as if nothing had gone wrong. Without the listener, Node.js treats an unhandled promise rejection as fatal: it prints the error and exits with code 1

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content