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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Berian Lowe](https://uploads.teamtreehouse.com/production/profile-photos/11513352/micro_IMG_0567.jpg)
Berian Lowe
22,438 PointsIncorrect error message
How come the error.message
states (Found)
on a user that could not be found?
e.g.
There was an error getting the profile for chalkers123123. (Found)
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe server operation has apparently changed since that course was created. Now, instead of returning a "not found" error, the server redirects you to your home page.
You may want to report this to Support, they can add something to the "Teacher's Notes" and it should get you a "special Exterminator badge".
Historical Note: The video uses "chalers123" but then some joker created an account with that name.
![Berian Lowe](https://uploads.teamtreehouse.com/production/profile-photos/11513352/micro_IMG_0567.jpg)
Berian Lowe
22,438 PointsThanks for the explanation Steven!
To remedy, I've added an extra check to the profiles.js. This checks if the Status Code is a redirect (302) and that the location of the redirect is https://teamtreehouse.com/home.
Probably not the most ideal or elegant of solutions but it seems to do the trick, and it got me looking more into status codes and all the different keys you can access from response.headers !
// Connect to the API URL (https://teamtreehouse.com/profiles/username.json)
var request = https.get("https://teamtreehouse.com/profiles/" + username + ".json", function(response) {
var body = "";
// Added this addition check:
if (response.statusCode === 302 && response.headers.location === "https://teamtreehouse.com/home") {
request.abort();
profileEmitter.emit("error", new Error("There was an error getting the profile for " + username + ". (Not Found)"));
return;
} else if (response.statusCode !== 200) {
request.abort();
//Status Code Error
profileEmitter.emit("error", new Error("There was an error getting the profile for " + username + ". (" + http.STATUS_CODES[response.statusCode] + ")"));
}
I did notice that there was a chalkers123 account which was the error example Andrew gave in the videos! 😂
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsOh that's right! I updated my note about it.
And checking for a redirect status is a perfect solution given the way the server operates now. I don't think it's even necessary to check the location.