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 Node.js Basics Handling Errors in Node Handle Status Code Errors

Seth Missiaen
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Seth Missiaen
Web Development Techdegree Graduate 21,652 Points

I can't create an error code 404, I only get 302 (message: Found)

I followed along with the code in this video and I'm trying to recreate an error code 404 (Not Found). The only code I get when I input a username that does not exist is code 302 (Found). If I change other parts of the address (besides https), I usually get 302, but sometimes I get code 401 (Unauthorized). Is it normal to get a code 302?

2 Answers

Andre Hammons
Andre Hammons
9,278 Points

The website automatically redirects you to the home page if the requested page is not found. A 300 status code shows a connection was made but not at the requested location, or something like that.

ChienTsun Chan
ChienTsun Chan
7,042 Points

I also got 302 status code (Found)