Skip to content

Commit

Permalink
add default rpc error message when missing
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Apr 15, 2024
1 parent 6e8b35a commit c03138e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/monero/common/MoneroRpcConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,13 @@ private static void validateHttpResponse(CloseableHttpResponse resp) {
}

@SuppressWarnings("unchecked")
private static void validateRpcResponse(Map<String, Object> respMap, String method, Object params) {
private void validateRpcResponse(Map<String, Object> respMap, String method, Object params) {
Map<String, Object> error = (Map<String, Object>) respMap.get("error");
if (error == null) return;
String msg = (String) error.get("message");
String errorMsg = (String) error.get("message");
int code = ((BigInteger) error.get("code")).intValue();
throw new MoneroRpcError(msg, code, method, params);
if ("".equals(errorMsg)) errorMsg = "Received error response from RPC request with method '" + method + "' to " + uri; // TODO (monero-project): response sometimes has empty error message
throw new MoneroRpcError(errorMsg, code, method, params);
}

private RequestConfig getRequestConfig(Long timeoutInMs) {
Expand Down

0 comments on commit c03138e

Please sign in to comment.