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 trialDamian McCarthy
3,656 PointsYou didn't call `console.error` in the error callback.
I am not sure why I am getting this error because it is there.
const https = require("https");
const request = https.get("https://teamtreehouse.com/chalkers.json", response => {
console.log(response.statusCode);
});
request.on('error', error => console.error('${error.message}'));
2 Answers
Steven Parker
231,236 PointsYou're attempting to use string interpolation, but your string is enclosed with apostrophes ("single quotes"). String interpolation is only performed on strings enclosed with accents ("back ticks").
But the challenge isn't expecting that anyway. And since error.message
is a string, you can use it directly as the argument to the console function.
Damian McCarthy
3,656 PointsThanks, I am a potato!
Damian McCarthy
3,656 PointsDamian McCarthy
3,656 PointsI really don't get it then. What am I supposed to be doing if not that?
Steven Parker
231,236 PointsSteven Parker
231,236 PointsWhat I mean by "use it directly as the argument" would look like this
console.error(error.message)