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

alee2
alee2
4,103 Points

in the error callback, use the error method on the console to print out the error message.

I'm not sure why my code isn't working....I've even pasted the code from the (working) video lesson abd it's still saying line 7 Unexpected token.

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(`problem with request: ${error.message}`));

1 Answer