Permalink
Browse files

Better error handling

  • Loading branch information...
1 parent b07a07f commit a76c7c5270fcacbbcfc42ace7a61aa23ad01d5f7 @kriszyp committed Jan 3, 2011
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/model/package.js
View
@@ -133,14 +133,13 @@ function updateVersions(pckg, force){
}
};
packageUpdates.push(request({url:repo.url + "/raw/" + gitVersion + "/package.json"}).then(function(response){
- return response.body.join("");
+ return response && response.body.join("");
}).then(function(packageJson){
try{
- print("updated package descriptor " + descriptorForVersion.version);
var packageData = JSON.parse(packageJson);
var dependencies = {};
// if mappings are there, go through and publish any dependent projects
- if(packageData.mappings){
+ if(packageData && packageData.mappings){
for(var mapping in packageData.mappings){
var target = packageData.mappings[mapping];
dependencies[mapping] = target.replace(/.*\/v?/,'');
@@ -179,7 +178,6 @@ function updateVersions(pckg, force){
afterUpdate(); // if there is an error, still continue with download
});
function afterUpdate(){
- print("finished updating " + versions)
//versions.$expires = now + (now - versions.$mtime || 10000) / 5;
if(wasUpdated){
var now = new Date().getTime();

0 comments on commit a76c7c5

Please sign in to comment.