Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public class RpcException
- Object
- Throwable
- Exception
- IOException
- RpcException
A failure the remote end reported: an HTTP status outside 2xx, or a JSON-RPC error object.
getCode is the HTTP status for the first and the JSON-RPC error code for the second;
isHttp says which.Constructors
public RpcException(int code, String message, Object data, boolean http) | An error with a code, a message and the optional error data. |
Methods
public static RpcException http(int status, String body) | An HTTP failure. |
public int getCode() | The HTTP status or the JSON-RPC error code. |
public boolean isHttp() | Whether the code is an HTTP status. |
public Object getData() | The JSON-RPC error’s data member, or the HTTP body. |
Inherited methods
Constructor details
RpcException
public RpcException(int code, String message, Object data, boolean http)An error with a code, a message and the optional error data.
Method details
http
public static RpcException http(int status, String body)An HTTP failure.
getCode
public int getCode()The HTTP status or the JSON-RPC error code.
isHttp
public boolean isHttp()Whether the code is an HTTP status.
getData
public Object getData()The JSON-RPC error’s
data member, or the HTTP body.