JavaScript Node.js Basics Handling Errors in Node Handling Errors in Node

William Mead
William Mead
4,200 Points

console.error not working on challenge

This challenge is not recognizing the fact that I am calling console.error in my code. I think it is giving me an erroneous error message.

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('there was a problem ' + error.message));

1 Answer

Your error message is: You didn't call console.error in the error callback. I agree that doesn't describe the issue. The instructions are to print out the error message. Try just the error message without the extra text.

William Mead
William Mead
4,200 Points

Yeah, this worked. Limitation of the code checker, I guess.