Login Register

dojo.rpc.JsonService addErrback()

Hi:

I have a JSON-RPC service created in the following way:

var serviceDefinition = {serviceType:'JSON-RPC'};    	
serviceDefinition['serviceURL']= 'http://localhost:8080/JSON-RPC';
var jsonService = new dojo.rpc.JsonService(serviceDefinition);

// function call if JSON request completes with success
var success = function(result) {
	.....	
	}
	  
// function call if JSON request completes with an error
var error = function(error) {			
	.....
	}					

var deferred = jsonService.callRemote('service.getSomething', params);
deferred.addErrback(error);
deferred.addCallback(success);

On a successful condition, the call back is made correctly with a defined result object. However, when an error is encountered, the error call back is made with an error object which is undefined. I can see in the response from the post that a JSON formatted ERROR comes back, but it is never passed to the error call back. Can anyone see what I am doing wrong? Advice is appreciated.

Thanks,

Tuck