When an internal/connection error occur (network error, JSON parsing error, failed to convert to expected class, ...), the JSONRPCResponseHandler will forward the error in the following order:
This way, if you don't implement methodCall:shouldForwardConnectionError: in the delegate object that expect the response, it will fall back to the implementation of the JSONRPCService's delegate to handle generic cases (which typically display an alert or something).
If you want to catch the error on specific cases, you still can implement methodCall:shouldForwardConnectionError: in the JSONRPCResponseHandler's delegate object to catch it. At this point, you can return YES to still execute the default behavior (the one in your JSONRPCService's delegate implementation) or return NO to avoid forwarding the error.
For error returned by the server (a JSON is received but it contains an "error" object), indicating something went wrong in the server (unknown method name, bad parameters, method-specific errors, ...), this object is simply passed as an NSError in the third parameter of the JSONRPCResponseHandler's delegate callback.
This method can receive these kinds of errors:
Network error (Domain NSURLErrorDomain)
JSON Parsing error (Domain SBJSONErrorDomain), whose userInfo dictionary contains the following keys:
JSON-to-Object Conversion error or internal errors (Domain JSONRPCInternalErrorDomain), whose userInfo dictionary may contain the following keys:
For now, the JSONRPCInternalErrorDomain domain contains two error codes :
This section only receive error that comes directly from the WebService you query using JSON-RPC. When the server returned an error in its JSON response, this is obviously a server-dependant error code.
JSONRPCErrorJSONObjectKey
key.{ code: // A Number that indicates the error type that occurred. See also reserved codes at http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php message: // A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. data: // A value that contains additional information about the error. Defined by the Server (e.g. detailed error information, nested errors etc.). }
JSONRPCErrorJSONObjectKey
, but in addition: