Package org.moera.lib.jsonrpc
Class JsonRpcApiException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.moera.lib.jsonrpc.JsonRpcApiException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MoeraNamingApiException
,PushRelayApiException
Represents an exception thrown when a JSON-RPC API interaction encounters an error.
This exception provides additional information about the error through an associated JSON-RPC error code.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJsonRpcApiException
(int rpcCode, String message) Constructs a newJsonRpcApiException
instance with a specified JSON-RPC error code and message.JsonRpcApiException
(JsonRpcError jsonRpcError) Constructs a newJsonRpcApiException
instance using the specifiedJsonRpcError
. -
Method Summary
Modifier and TypeMethodDescriptionint
Retrieves the JSON-RPC error code associated with this exception.Constructs and returns aJsonRpcError
object representing the JSON-RPC error associated with this exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JsonRpcApiException
Constructs a newJsonRpcApiException
instance with a specified JSON-RPC error code and message.- Parameters:
rpcCode
- the JSON-RPC error code associated with this exceptionmessage
- the detail message providing additional information about the error
-
JsonRpcApiException
Constructs a newJsonRpcApiException
instance using the specifiedJsonRpcError
.- Parameters:
jsonRpcError
- the JSON-RPC error containing error code and message to associate with this exception
-
-
Method Details
-
getRpcCode
public int getRpcCode()Retrieves the JSON-RPC error code associated with this exception.- Returns:
- the JSON-RPC error code representing the specific error condition
-
getRpcError
Constructs and returns aJsonRpcError
object representing the JSON-RPC error associated with this exception. The returned error object will contain the error code and message of this exception.- Returns:
- a
JsonRpcError
object containing the error code and message.
-