Permalink
Browse files

Fix error messages, handle 301

  • Loading branch information...
1 parent ad77634 commit 28c0bd6f63ac882543bbbdc333897f8efd2863c7 @kriszyp committed Nov 6, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/nodules.js
View
@@ -430,7 +430,7 @@ function makeRequire(currentId){
moduleExports[id] || defaultRequire(id);
}catch(e){
factories[uri] = function(){
- throw new Error(error.message + " failed to load " + uri);
+ throw new Error(error.stack + " failed to load " + uri);
};
}
decrementWaiting();
@@ -754,7 +754,7 @@ function getUri(uri, tries){
}
print("Downloading " + uri + (tries > 1 ? " attempt #" + tries : ""));
return requestedUris[uri] = request({url:uri, encoding:"binary"}).then(function(response){
- if(response.status == 302){
+ if(response.status == 302 || response.status == 301){
return getUri(response.headers.location);
}
if(response.status < 300){
@@ -772,7 +772,7 @@ function getUri(uri, tries){
if(response.status == 404){
return null;
}
- throw new Error(response.status + response.body);
+ throw new Error(response.status);
}, function(error){
tries++;
if(tries > 3){

0 comments on commit 28c0bd6

Please sign in to comment.