Skip to content

Commit

Permalink
Make S3 Error Handling Better
Browse files Browse the repository at this point in the history
  • Loading branch information
groundwater committed Dec 3, 2012
1 parent e92bd8b commit 0e97dbe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/s3.js
Expand Up @@ -43,7 +43,7 @@ function publish(config,db,url){

log.Info('Beginning Upload …')

async.forEach(Object.keys(config),function(name,done){
async.forEachSeries(Object.keys(config),function(name,done){
var hash = config[name]
db.attachment.get(hash,name,function(err,body){
if(err) return log.Error('',err)
Expand All @@ -70,7 +70,7 @@ function publish(config,db,url){
var code = res.statusCode
if(code==404){
log.Error('Bucket `%s` Not Found',bucket)
}else if(code==307){
}else if(code>=300 && code<400){
log.Error('Upload Error, Please Check that Your AWS Bucket Agrees with Your Region')
}else{
log.Error('Status Code %d',code)
Expand All @@ -79,6 +79,9 @@ function publish(config,db,url){
done(code)
}
})
req.on('error',function(err){
log.Error(err)
})
req.end(body)

})
Expand Down

0 comments on commit 0e97dbe

Please sign in to comment.