var request = nodeRequire("request");
dlog('标记1');
request.head(src, function(err, res_req, body){
dlog('标记2');
}).on('error', function(err) {
dlog('标记3');
console.log(err)
});
标记1输出230次,标记2输出202次,标记3是0次,那意思就是有一些丢失了,最可能的原因是什么。
......
request.head(src, function(err, res_req, body){
......
}).on( 'error', function(err) {
Don’t you think it’s strange, why are there err in the parameters in both places? What’s the difference between these two err? Where exactly should errors be handled?
So the questioner should read the document carefully. There are two writing methods to choose from:
or