handle error when listing bucket

This commit is contained in:
Brian Gough 2015-03-31 10:35:33 +01:00
parent 801b5653e4
commit 07e53bbb2f

View file

@ -104,6 +104,9 @@ module.exports =
secret: settings.filestore.s3.secret secret: settings.filestore.s3.secret
bucket: bucketName bucket: bucketName
s3Client.list prefix:key, (err, data)-> s3Client.list prefix:key, (err, data)->
if err?
logger.err err:err, bucketName:bucketName, key:key, "something went wrong listing prefix in aws"
return callback(err)
keys = _.map data.Contents, (entry)-> keys = _.map data.Contents, (entry)->
return entry.Key return entry.Key
s3Client.deleteMultiple keys, callback s3Client.deleteMultiple keys, callback