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 2017 Handling Errors in Node Handling Errors in Node

Damian McCarthy
Damian McCarthy
3,656 Points

You didn't call `console.error` in the error callback.

I am not sure why I am getting this error because it is there.

app.js
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
Steven Parker
231,269 Points

You'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
Damian McCarthy
3,656 Points

I really don't get it then. What am I supposed to be doing if not that?

Steven Parker
Steven Parker
231,269 Points

What I mean by "use it directly as the argument" would look like this :point_right: console.error(error.message)