Skip to content

Commit

Permalink
Clean up the console message for possible S3 errors
Browse files Browse the repository at this point in the history
* Since OpenUserJS#1086 haven't seen any of these yet for OpenUserJS#486
* Use an environment variable to toggle monitoring this for now


Applies to OpenUserJS#430
  • Loading branch information
Martii committed Apr 24, 2017
1 parent 71a66d4 commit 00582c5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 00582c5

Please sign in to comment.