Package org.starcoin.jsonrpc.client
Class JSONRPC2SessionException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.starcoin.jsonrpc.client.JSONRPC2SessionException
-
- All Implemented Interfaces:
Serializable
public class JSONRPC2SessionException extends Exception
Thrown to indicate a JSON-RPC 2.0 client session exception. Allows a general cause type to be specified to ease diagnostics and exception reporting.- Author:
- Vladimir Dzhuvinov
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intBAD_RESPONSEInvalid JSON-RPC 2.0 response (invalid JSON or invalid JSON-RPC 2.0 response message).static intJSONRPC2_ERRORReceived a JSON-RPC 2.0 error response.static intNETWORK_EXCEPTIONThe exception cause is network or I/O related.static intUNEXPECTED_CONTENT_TYPEUnexpected "Content-Type" header value of the HTTP response.static intUNEXPECTED_RESULTUnexpected JSON-RPC 2.0 response result (the result doesn't match the JSON type / format expected by the client).static intUNSPECIFIEDUnspecified cause type.
-
Constructor Summary
Constructors Constructor Description JSONRPC2SessionException(String message)Creates a new JSON-RPC 2.0 session exception with the specified message; the cause type isUNSPECIFIED.JSONRPC2SessionException(String message, int causeType)Creates a new JSON-RPC 2.0 session exception with the specified message and cause type.JSONRPC2SessionException(String message, int causeType, Throwable cause)Creates a new JSON-RPC 2.0 session exception with the specified message, cause type and cause.JSONRPC2SessionException(String message, Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCauseType()Returns the exception cause type.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
UNSPECIFIED
public static final int UNSPECIFIED
Unspecified cause type.- See Also:
- Constant Field Values
-
NETWORK_EXCEPTION
public static final int NETWORK_EXCEPTION
The exception cause is network or I/O related.- See Also:
- Constant Field Values
-
UNEXPECTED_CONTENT_TYPE
public static final int UNEXPECTED_CONTENT_TYPE
Unexpected "Content-Type" header value of the HTTP response.- See Also:
- Constant Field Values
-
BAD_RESPONSE
public static final int BAD_RESPONSE
Invalid JSON-RPC 2.0 response (invalid JSON or invalid JSON-RPC 2.0 response message).- See Also:
- Constant Field Values
-
UNEXPECTED_RESULT
public static final int UNEXPECTED_RESULT
Unexpected JSON-RPC 2.0 response result (the result doesn't match the JSON type / format expected by the client).- See Also:
- Constant Field Values
-
JSONRPC2_ERROR
public static final int JSONRPC2_ERROR
Received a JSON-RPC 2.0 error response.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JSONRPC2SessionException
public JSONRPC2SessionException(String message)
Creates a new JSON-RPC 2.0 session exception with the specified message; the cause type isUNSPECIFIED.- Parameters:
message- The message.
-
JSONRPC2SessionException
public JSONRPC2SessionException(String message, int causeType)
Creates a new JSON-RPC 2.0 session exception with the specified message and cause type.- Parameters:
message- The message.causeType- The cause type, see the constants.
-
JSONRPC2SessionException
public JSONRPC2SessionException(String message, int causeType, Throwable cause)
Creates a new JSON-RPC 2.0 session exception with the specified message, cause type and cause.- Parameters:
message- The message.causeType- The cause type, see the constants.cause- The original exception.
-
-