ikrs.json.rpc
Class DefaultJSONRPCError

java.lang.Object
  extended by ikrs.json.AbstractJSONValue
      extended by ikrs.json.JSONObject
          extended by ikrs.json.rpc.DefaultJSONRPCError
All Implemented Interfaces:
JSONValue, JSONRPCError

public class DefaultJSONRPCError
extends JSONObject
implements JSONRPCError

The default JSONRPCError implementation.


Field Summary
static int CODE_INTERNAL_JSON_ERROR
          Internal error.
static int CODE_INVALID_PARAMS
          Invalid params.
static int CODE_INVALID_REQUEST
          Invalid Request.
static int CODE_METHOD_NOT_FOUND
          Method not found.
static int CODE_PARSE_ERROR
          Parse error.
static int CODE_SERVER_ERROR_MIN
          Server error.
 
Fields inherited from interface ikrs.json.JSONValue
FALSE, NULL, TRUE, TYPE_ARRAY, TYPE_BOOLEAN, TYPE_NULL, TYPE_NUMBER, TYPE_OBJECT, TYPE_STRING
 
Constructor Summary
DefaultJSONRPCError()
           
DefaultJSONRPCError(JSONValue code, JSONValue message, JSONValue data)
           
 
Method Summary
 JSONValue getCode()
          This method returns the value of the 'jsonrpc' field from this request.
 JSONValue getData()
          Get the error object from the response (if result is null).
 JSONValue getMessage()
          Get the RPC result of the call.
 
Methods inherited from class ikrs.json.JSONObject
asJSONArray, asJSONObject, getMap, getObject, main, toString, write
 
Methods inherited from class ikrs.json.AbstractJSONValue
asJSONBoolean, asJSONNumber, asJSONString, getArray, getBoolean, getNumber, getString, getTypeName, isArray, isBoolean, isNull, isNumber, isObject, isString, isValidTypeID, toJSONString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ikrs.json.JSONValue
asJSONArray, asJSONBoolean, asJSONNumber, asJSONObject, asJSONString, getArray, getBoolean, getNumber, getObject, getString, isArray, isBoolean, isNull, isNumber, isObject, isString, toJSONString, write
 

Field Detail

CODE_PARSE_ERROR

public static final int CODE_PARSE_ERROR
Parse error. Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.

See Also:
Constant Field Values

CODE_INVALID_REQUEST

public static final int CODE_INVALID_REQUEST
Invalid Request. The JSON sent is not a valid Request object.

See Also:
Constant Field Values

CODE_METHOD_NOT_FOUND

public static final int CODE_METHOD_NOT_FOUND
Method not found. The method does not exist / is not available.

See Also:
Constant Field Values

CODE_INVALID_PARAMS

public static final int CODE_INVALID_PARAMS
Invalid params. Invalid method parameter(s).

See Also:
Constant Field Values

CODE_INTERNAL_JSON_ERROR

public static final int CODE_INTERNAL_JSON_ERROR
Internal error. Internal JSON-RPC error.

See Also:
Constant Field Values

CODE_SERVER_ERROR_MIN

public static final int CODE_SERVER_ERROR_MIN
Server error. Reserved for implementation-defined server-errors.

See Also:
Constant Field Values
Constructor Detail

DefaultJSONRPCError

public DefaultJSONRPCError()

DefaultJSONRPCError

public DefaultJSONRPCError(JSONValue code,
                           JSONValue message,
                           JSONValue data)
Method Detail

getCode

public JSONValue getCode()
This method returns the value of the 'jsonrpc' field from this request.

Specified by:
getCode in interface JSONRPCError
Returns:
null if the request has no 'jsonrpc' field.

getMessage

public JSONValue getMessage()
Get the RPC result of the call. Due to the specification the result MUST be null if there were errors.

Specified by:
getMessage in interface JSONRPCError
Returns:
The RPC result or JSON-null/Java-null on errors.

getData

public JSONValue getData()
Get the error object from the response (if result is null). Due to the specification the error object MUST be null if there were no errors.

Specified by:
getData in interface JSONRPCError
Returns:
The error result if there were errors.