From 00582c5359b182bef89bd4e60b9e6091a9082a3d Mon Sep 17 00:00:00 2001 From: Martii Date: Sun, 23 Apr 2017 23:23:47 -0600 Subject: [PATCH] Clean up the console message for possible S3 errors * Since #1086 haven't seen any of these yet for #486 * Use an environment variable to toggle monitoring this for now Applies to #430 --- controllers/scriptStorage.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/controllers/scriptStorage.js b/controllers/scriptStorage.js index fc900fdad..ada3b5418 100644 --- a/controllers/scriptStorage.js +++ b/controllers/scriptStorage.js @@ -331,10 +331,15 @@ exports.getSource = function (aReq, aCallback) { Bucket: bucketName, Key: installNameBase + (isLib ? '.js' : '.user.js') - }).createReadStream().on('error', function () { - // TODO: #486 - if (isDbg) { - console.error('S3 key not found for', installNameBase + (isLib ? '.js' : '.user.js')); + }).createReadStream().on('error', function (aE) { + // Possible #486 modification + if (isDbg || process.env.MONITOR_S3_READ_ERR === 'true') { + console.error( + 'S3 GET', + aE.code, + 'for', installNameBase + (isLib ? '.js' : '.user.js'), + 'in the', bucketName, 'bucket' + ); } aCallback(null);