What is the role of the error-handling middleware when dealing with unhandled promise rejections in Express?

  • It converts promise rejections into synchronous errors
  • It terminates the Node.js process to prevent unhandled rejections
  • It logs the unhandled promise rejection and continues execution
  • It captures unhandled promise rejections and sends them to the default error handler
The error-handling middleware in Express captures unhandled promise rejections and sends them to the default error handler. This allows you to handle unhandled promise rejections gracefully in your Express application. The other options are not the typical roles of error-handling middleware in this context.
Add your answer
Loading...

Leave a comment

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