Complete the code to catch uncaught exceptions in Node.js.
process.on('uncaughtException', (err) => { console.[1]('Caught exception:', err); });
The process.on('uncaughtException') event handler uses console.error to log errors clearly.
Complete the code to exit the process after logging an uncaught exception.
process.on('uncaughtException', (err) => { console.error(err); process.[1](1); });
Use process.exit(1) to stop the Node.js process with an error code after handling the exception.
Fix the error in the code to properly handle uncaught exceptions.
process.on('uncaughtException', (error) => { console.error('Error:', [1]); });
The callback parameter is named error, so use error to log the full error object.
Fill both blanks to log the error stack and then exit the process.
process.on('uncaughtException', (err) => { console.[1](err.[2]); process.exit(1); });
Use console.error to log the error stack trace (err.stack) for detailed debugging.
Fill all three blanks to create a handler that logs the error, cleans up, and exits.
process.on('uncaughtException', (err) => { console.[1]('Uncaught:', err.[2]); cleanup(); process.[3](1); });
Use console.log to print a simple message with err.message, then call process.exit(1) after cleanup.