(method, args, context)
| 27 | var filer = new Filer(); |
| 28 | |
| 29 | var fsCall = function(method, args, context) { |
| 30 | if (!_syncIsEnable) return Q.reject(new Error("Offline synchronization is disabled")); |
| 31 | if (_.isUndefined(args)) args = []; |
| 32 | if (!_.isArray(args)) args = [args]; |
| 33 | |
| 34 | var d = Q.defer(); |
| 35 | args.push(function() { |
| 36 | if (arguments.length == 1) return d.resolve(arguments[0]); |
| 37 | d.resolve(arguments); |
| 38 | }); |
| 39 | args.push(function(err) { |
| 40 | logger.error("Error occurs: ", method.name, err); |
| 41 | d.reject(err); |
| 42 | }) |
| 43 | |
| 44 | try { |
| 45 | method.apply(context, args); |
| 46 | } catch(err) { |
| 47 | d.reject(err); |
| 48 | } |
| 49 | |
| 50 | return d.promise; |
| 51 | }; |
| 52 | |
| 53 | /* |
| 54 | * Init the localfs |
no outgoing calls
no test coverage detected