From ddab15af4594f18c16e719c34343ebd8ba0bb930 Mon Sep 17 00:00:00 2001 From: Marti Martz Date: Sun, 23 Apr 2017 23:24:40 -0600 Subject: [PATCH] Clean up the console message for possible S3 errors (#1094) * Since #1086 haven't seen any of these yet for #486 * Use an environment variable to toggle monitoring this for now Applies to #430 Auto-merge --- 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);