when making an http.request
there are 2 events that produce errors: request.on('error')
and response.on('error')
.
I can't see a difference because both errors come from the web server.
what's the difference between thisError
and thatError
?
var request = http.request({hostname:"example.com"}, function(response){
response.on('error', function(thisError){
//what's the difference between thisError <<<<<<
});
});
request.on('error', function(thatError){
//and thatError <<<<<
});
During a request you resolve a name, establish a connection, send a bunch of data, and each task could result in an error.
When you receive data through a response object, as an example the other end could close the connection unexpectedly.
Those errors are different and they must belong to the right structure, in this case respectively request and response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With