In Node.js, what is the purpose of the process.on('uncaughtException', handler) method?

  • To catch exceptions and continue program execution
  • To exit the Node.js process on any unhandled exception
  • To display uncaught exceptions in the console
  • To handle exceptions within a specific function
The process.on('uncaughtException', handler) method in Node.js is used to capture unhandled exceptions and prevent the Node.js process from crashing. It allows you to specify a custom handler function to handle these exceptions gracefully. The other options do not accurately describe the purpose of this method.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *