summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/changes/changes.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/changes/changes.js b/modules/changes/changes.js
index f16c2ea..8851dbd 100644
--- a/modules/changes/changes.js
+++ b/modules/changes/changes.js
@@ -93,7 +93,7 @@ function fetch(method,url,data/*?*/,cb){
try {
url=URL.parse(url);
} catch(e){
- cb(-1,null);
+ cb(-1,"URL parse failed: "+e.message);
return;
}
@@ -102,7 +102,7 @@ function fetch(method,url,data/*?*/,cb){
case "http:": httpclass=http; break;
case "https:": httpclass=https; break;
default:
- cb(-1,null);
+ cb(-1,"Invalid URL protocol "+url.protocol);
return;
}
@@ -114,16 +114,19 @@ function fetch(method,url,data/*?*/,cb){
body+=data;
});
res.on("end",function(){
- if(!cbcalled)cb(res.statusCode,body);
+ if(!cbcalled){
+ if(res.statusCode==-1)cb(-1,"negative status code");
+ else cb(res.statusCode,body);
+ }
cbcalled=true;
});
res.on("error",function(err){
- if(!cbcalled)cb(-1,err);
+ if(!cbcalled)cb(-1,"response error: "+err);
cbcalled=true;
});
});
req.on("error",function(err){
- if(!cbcalled)cb(-1,err);
+ if(!cbcalled)cb(-1,"request error: "+err);
cbcalled=true;
});
if(data)req.write(data);
@@ -142,7 +145,7 @@ function refreshURLs(cb){
nwaiting++;
fetch("GET",url,function(url,status,body){
nwaiting--;
- console.log("Got <"+url+">; status = "+status);
+ console.log("Got <"+url+">; status = "+status+(status==-1?" ("+body+")":""));
var dosave=true;
if(status==-1){
hashes[url]=[new Date(),null,null];