@@ -803,7 +803,8 @@ class FilesCollection
803
803
opts .path = " #{ @storagePath } /#{ FSName}#{ extensionWithDot} "
804
804
805
805
request .get (url).on (' error' , (error )-> bound ->
806
- throw new Meteor.Error 500 , " Error on [load(#{ url} )]:" + JSON .stringify error
806
+ callback and callback error
807
+ console .error " [FilesCollection] [load] [request.get(#{ url} )]:" , error if self .debug
807
808
).on (' response' , (response ) -> bound ->
808
809
809
810
console .info " [FilesCollection] [load] Received: #{ url} " if self .debug
@@ -821,7 +822,7 @@ class FilesCollection
821
822
self .collection .insert _ .clone (result), (error ) ->
822
823
if error
823
824
callback and callback error
824
- console .warn " [FilesCollection] [load] [insert] Error: #{ fileName} -> #{ self .collectionName } " , error if self .debug
825
+ console .error " [FilesCollection] [load] [insert] Error: #{ fileName} -> #{ self .collectionName } " , error if self .debug
825
826
else
826
827
callback and callback null , result
827
828
console .info " [FilesCollection] [load] [insert] #{ fileName} -> #{ self .collectionName } " if self .debug
@@ -1384,31 +1385,29 @@ class FilesCollection
1384
1385
@memberOf FilesCollection
1385
1386
@name remove
1386
1387
@param {String|Object} search - `_id` of the file or `Object` like, {prop:'val'}
1387
- @param {Function} cb - Callback with one `error` argument
1388
+ @param {Function} callback - Callback with one `error` argument
1388
1389
@summary Remove file(s) on cursor or find and remove file(s) if search is set
1389
1390
@returns {FilesCollection} Instance
1390
1391
###
1391
- remove : (search , cb ) ->
1392
+ remove : (search , callback ) ->
1392
1393
console .info " [FilesCollection] [remove(#{ JSON .stringify (search)} )]" if @debug
1393
1394
check search, Match .Optional Match .OneOf Object , String
1394
- check cb , Match .Optional Function
1395
+ check callback , Match .Optional Function
1395
1396
1396
1397
@ srch search
1397
1398
if Meteor .isClient
1398
1399
if @allowClientCode
1399
- Meteor .call @methodNames .MeteorFileUnlink , search, (if cb then cb else NOOP)
1400
+ Meteor .call @methodNames .MeteorFileUnlink , search, (callback or NOOP)
1400
1401
else
1401
- if cb
1402
- cb new Meteor.Error 401 , ' [FilesCollection] [remove] Run code from client is not allowed!'
1403
- else
1404
- throw new Meteor.Error 401 , ' [FilesCollection] [remove] Run code from client is not allowed!'
1402
+ callback and callback new Meteor.Error 401 , ' [FilesCollection] [remove] Run code from client is not allowed!'
1403
+ console .warn ' [FilesCollection] [remove] Run code from client is not allowed!' if @debug
1405
1404
1406
1405
if Meteor .isServer
1407
1406
files = @collection .find @search
1408
1407
if files .count () > 0
1409
1408
self = @
1410
1409
files .forEach (file) -> self .unlink file
1411
- @collection .remove @search , cb
1410
+ @collection .remove @search , (callback or NOOP)
1412
1411
return @
1413
1412
1414
1413
###
0 commit comments