request : function(service, method) {
var last;
var deferred = $q.defer();
+ var params = Array.prototype.slice.call(arguments, 2);
new OpenSRF.ClientSession(service).request({
async : true,
method : method,
- params : Array.prototype.slice.call(arguments, 2),
+ params : params,
oncomplete : function() {
deferred.resolve(last ? last.content() : null);
},
deferred.notify(last.content());
},
onerror : function(msg) {
+ // 'msg' currently tells us very little, so don't
+ // bother JSON-ifying it, since there is the off
+ // chance that JSON-ification could fail, e.g if
+ // the object has circular refs.
+ console.error(method +
+ ' (' + params + ') failed. See server logs.');
deferred.reject(msg);
}
}).send();