In Express.js, to catch errors from a promise within a route, the next function should be called with the ______ as an argument.

  • error
  • promise
  • err
  • next
In Express.js, to catch errors from a promise within a route, the next function should be called with the err as an argument. This allows Express.js to recognize it as an error-handling middleware. Passing error, promise, or next itself would not trigger the error handling mechanism in Express.js.
Add your answer
Loading...

Leave a comment

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