Package org.consensusj.jsonrpc
Interface DefaultRpcClient.TransientErrorMapper<T>
- Type Parameters:
T
- The expected result type
- Enclosing class:
DefaultRpcClient
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for ignoring what are considered "transient" errors. The definition of what is transient
may vary depending upon the application. Different implementations of this function can be created for
different applications.
The JsonRpcResponse
returned may be a "synthetic" response, that is generated by the client,
not by the server. The synthetic response will look like this:
- error.code: -20000
- error.message: "Server temporarily unavailable"
- error.data: Detailed string message, e.g. "Connection refused"
-
Method Summary
Modifier and TypeMethodDescriptionmap
(JsonRpcRequest request, JsonRpcResponse<T> response, Throwable throwable)
-
Method Details
-
map
CompletableFuture<JsonRpcResponse<T>> map(JsonRpcRequest request, JsonRpcResponse<T> response, Throwable throwable) - Parameters:
request
- The request we're handling completions forresponse
- response if one was successfully returned (or null)throwable
- exception if the call failed (or null)- Returns:
- A completed or failed future than can replace the input (response, throwable) pair
-