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)
![Anthony Scott](https://secure.gravatar.com/avatar/77e43f3f6325c80fe28d0dfabfd4d6ba?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Anthony Scott
Courses Plus Student 9,001 PointsNot getting the proper error.
I added the code to line 33 to get an error output but I don't get an error just a blank line. Why is that?
// Problem: We need a simple way to look at a user's badge count and JavaScript points
// Solution: Use Node.js to connect to Treehouse's API to get profile information to print out
//require https module
const https = require('https');
//function to print out message
function printMessage(username, badgeCount, points) {
const message = `${username} has ${badgeCount} total badge(s) and ${points} points in Javascript.`;
console.log(message);
}
//function to get multiple usernames
function getProfile(username) {
//connect to API url (https://teamtreehouse.com/username.json)
const request = https.get(`https://wwwcsscteamtreehouse.com/${username}.json`, response => {
let body = "";
//Read the json data
response.on('data', data => {
body += data.toString();
});
response.on('end', () => {
//parse the data
const profile = JSON.parse(body);
//print the data
printMessage(username, profile.badges.length, profile.points.JavaScript)
});
});
request.on('error', error => console.error(`Problem with request: ${error.message}`));
}
//process argv get arguments (users) from the command line
//slice leaves off the first two repsonses returned that arent usernames.
const users = process.argv.slice(2);
users.forEach(getProfile);
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsDid you provide an argument on the command line?
With no command line argument(s), the code that might generate the error never runs.
![Anthony Scott](https://secure.gravatar.com/avatar/77e43f3f6325c80fe28d0dfabfd4d6ba?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Anthony Scott
Courses Plus Student 9,001 Pointsyeah.... that was the issue. A little embarrassing! thanks