request.on('error')和response.on('error')之间有什么区别
http.request
一个http.request
有2个事件产生错误: request.on('error')
和response.on('error')
。
我看不出有什么不同,因为这两个错误都来自Web服务器。
thisError
和thatError
什么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 <<<<< });
在请求期间,您parsing名称,build立连接,发送大量数据,并且每个任务都可能导致错误。
当通过响应对象接收数据时,例如另一端可能会意外closures连接。
这些错误是不同的,他们必须属于正确的结构,在这种情况下,分别请求和响应。