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

Having issue with https://teamtreehouse.com/library/nodejs-basics-2/handling-errors-in-node/handling-errors-in-node

Having issue with https://teamtreehouse.com/library/nodejs-basics-2/handling-errors-in-node/handling-errors-in-node

Am putting in correct code but it says I am not. This happened on another code challenge earlier in this Node Basics. I had to refresh the browser several times and go back and forth between pages before it finally accepted the code. I think it is POST ing incorrectly for some reason. maybe something is up with the service.

2 Answers

This passes:

const https = require("https");

const request = https.get("https://teamtreehouse.com/chalkers.json", response => {
  console.log(response.statusCode);
});

request.on('error', function(error){
  console.error(error.message);
});

I hope that helps.

Stay safe and happy coding!

Thanks Peter. I figured it out about a minute after I posted. I was trying to set up a variable to concatenate the results into rather than assign the get into the variable. Cheers