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 Express Basics Middleware Error Handling Middleware

Julianna Kahn
Julianna Kahn
20,702 Points

Error code 500 prints out on the page as the code says but Dev Tools show a status of 304.

Where would this status be coming from?

1 Answer

I know this is an older post, but figured I'd post this here incase anyone is having the same issue.

you would have to set the error status manually for the browser network tracer to capture it as a 500. I included the snippet below where this is done.

app.use((req, res, next) => {
  const err = new Error("Oh Noes!");
  err.status = 500;

as you can see, I am manually setting the err.status to 500. This is how the browser will capture the 500 code within the network trace.