Below is the code for my Node.js HTTP response requester.
Once I use a website that I explicitly know does not exist, the error message would notify me the error: getaddrinfo ENOENT
I want to know more about this error. What spawns it? What's the detail of the error? Would 404' spawn it?
var hostNames = ['www.pageefef.com'];
for (i; i < hostNames.length; i++){
var options = {
host: hostNames[i],
path: '/'
};
(function (i){
http.get(options, function(res) {
var obj = {};
obj.url = hostNames[i];
obj.statusCode = res.statusCode;
// obj.headers = res.headers;
console.log(JSON.stringify(obj, null, 4));
}).on('error',function(e){
console.log("Error: " + hostNames[i] + "\n" + e.message);
});
})(i);
};