Commit 5b7e5d51 authored by Aaron Harder's avatar Aaron Harder

Fix error messaging to once again properly respond to specific S3 error status codes.

parent 6fbc70c8
......@@ -50,14 +50,16 @@ module.exports=function s3BackedRenditions(config, $){
}).on("error", function(err){
var msg;
if(err && err.message){
if(err.message.match(/403/)){
msg = `Error downloading rendition from S3 bucket ${s3conf.bucket}. Please check config at: ${confPath}`;
emailErrorOccasionally(params.emailError, msg);
log.error(msg, err);
}else{
msg = `Error downloading rendition from S3 bucket. ${err.message}`;
log.error(msg, err);
}
if(err.statusCode===404){
log.info("S3 cache miss. Generating new img-opt rendition.", params.renditionPath)
}else if(err.statusCode===403){
msg = `Error downloading rendition from S3 bucket ${s3conf.bucket}. Please check config at: ${confPath}`;
emailErrorOccasionally(params.emailError, msg);
log.error(msg, err);
}else{
msg = `Error downloading rendition from S3 bucket. ${err.message}`;
log.error(msg, err);
}
}else{
msg=`Unknown S3 download error.`;
log.error(msg, err);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment