Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

codingchewie
codingchewie
8,764 Points

Is this quiz question wrong for Express Basics?

Taking the quiz for:

What happens when an object is passed into the `next` function?

It has four options and it indicates the correct answer as:

Execution is passed to the next error handling middleware function

In the course context the block was used for error handling:

app.use((err, req, res, next) => {
  res.locals.error = err
  res.status(err.status)
  res.render('error')
})

but in general wouldn't the correct answer for this be the option of:

Execution is passed to the next middleware function

My understanding when next() is used it can either go to error or the next middleware. Looking for clarity because this quiz question is bugging me.