File tree 1 file changed +30
-14
lines changed
1 file changed +30
-14
lines changed Original file line number Diff line number Diff line change @@ -299,32 +299,48 @@ exports.getSource = function (aReq, aCallback) {
299
299
var isLib = aReq . params . isLib ;
300
300
301
301
Script . findOne ( {
302
- installName : caseSensitive ( installNameBase +
303
- ( isLib ? '.js' : '.user.js' ) )
302
+ installName : caseSensitive ( installNameBase + ( isLib ? '.js' : '.user.js' ) )
303
+
304
304
} , function ( aErr , aScript ) {
305
305
var s3Object = null ;
306
306
var s3 = new AWS . S3 ( ) ;
307
307
308
- // WARNING: Partial error handling at this stage
308
+ if ( aErr ) {
309
+ if ( isDbg ) {
310
+ console . error (
311
+ 'Document lookup failure for' ,
312
+ installNameBase + ( isLib ? '.js' : '.user.js' ) ,
313
+ aErr . message
314
+ ) ;
315
+ }
309
316
310
- if ( ! aScript ) {
311
317
aCallback ( null ) ;
318
+ return ;
319
+ }
320
+
321
+ if ( ! aScript ) {
312
322
if ( isDbg ) {
313
- console . warn ( 'no script found yet' ) ;
323
+ console . warn (
324
+ 'Document not found for' , installNameBase + ( isLib ? '.js' : '.user.js' )
325
+ ) ;
314
326
}
327
+ aCallback ( null ) ;
315
328
return ;
316
329
}
317
330
318
- s3Object = s3 . getObject ( { Bucket : bucketName , Key : installNameBase + ( isLib ? '.js' : '.user.js' ) } ) . createReadStream ( ) .
319
- on ( 'error' , function ( ) {
320
- // TODO: #486
321
- if ( isDbg ) {
322
- console . error ( 'S3 Key Not Found ' + installNameBase + ( isLib ? '.js' : '.user.js' ) ) ;
323
- }
331
+ s3Object = s3 . getObject ( {
332
+ Bucket : bucketName ,
333
+ Key : installNameBase + ( isLib ? '.js' : '.user.js' )
324
334
325
- aCallback ( null ) ;
326
- return ;
327
- } ) ;
335
+ } ) . createReadStream ( ) . on ( 'error' , function ( ) {
336
+ // TODO: #486
337
+ if ( isDbg ) {
338
+ console . error ( 'S3 key not found for' , installNameBase + ( isLib ? '.js' : '.user.js' ) ) ;
339
+ }
340
+
341
+ aCallback ( null ) ;
342
+ return ;
343
+ } ) ;
328
344
329
345
// Get the script
330
346
aCallback ( aScript , s3Object ) ;
You can’t perform that action at this time.
0 commit comments