Rename RpcNodeUnhealthy error to NodeUnhealthy, generalize getHealth RPC error object for the future

This commit is contained in:
Michael Vines
2021-01-17 20:23:14 -08:00
parent cbf8ef7480
commit 5d9dc609b1
6 changed files with 45 additions and 22 deletions

View File

@ -1294,7 +1294,9 @@ None
#### Results:
If the node is healthy: "ok"
If the node is unhealthy, a JSON RPC error response is returned indicating how far behind the node is.
If the node is unhealthy, a JSON RPC error response is returned. The specifics
of the error response are **UNSTABLE** and may change in the future
#### Example:
@ -1310,13 +1312,26 @@ Healthy Result:
{"jsonrpc":"2.0","result": "ok","id":1}
```
Unhealthy Result:
Unhealthy Result (generic):
```json
{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "RPC node is behind by 42 slots",
"message": "Node is unhealthy",
"data": {}
},
"id": 1
}
```
Unhealthy Result (if additional information is available)
```json
{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Node is behind by 42 slots",
"data": {
"numSlotsBehind": 42
}