5098: Update already merged RpcErrorTypes to include index in exception message (#7420)

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7422/head
Matilda-Clerke 4 months ago committed by GitHub
parent a6a0271ae2
commit 419995248b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugAccountRange.java
  2. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddAccountsToAllowlist.java
  3. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveAccountsFromAllowlist.java
  4. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermAddAccountsToAllowlistTest.java
  5. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/permissioning/PermRemoveAccountsFromAllowlistTest.java

@ -65,7 +65,7 @@ public class DebugAccountRange implements JsonRpcMethod {
addressHash = requestContext.getRequiredParameter(2, String.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid address hash parameter", RpcErrorType.INVALID_ADDRESS_HASH_PARAMS, e);
"Invalid address hash parameter (index 2)", RpcErrorType.INVALID_ADDRESS_HASH_PARAMS, e);
}
final int maxResults = requestContext.getRequiredParameter(3, Integer.TYPE);

@ -50,7 +50,7 @@ public class PermAddAccountsToAllowlist implements JsonRpcMethod {
accountsList = requestContext.getRequiredParameter(0, List.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid accounts list parameter", RpcErrorType.INVALID_ACCOUNT_PARAMS, e);
"Invalid accounts list parameter (index 0)", RpcErrorType.INVALID_ACCOUNT_PARAMS, e);
}
if (allowlistController.isPresent()) {

@ -50,7 +50,7 @@ public class PermRemoveAccountsFromAllowlist implements JsonRpcMethod {
accountsList = requestContext.getRequiredParameter(0, List.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid accounts list parameter", RpcErrorType.INVALID_ACCOUNT_PARAMS, e);
"Invalid accounts list parameter (index 0)", RpcErrorType.INVALID_ACCOUNT_PARAMS, e);
}
if (allowlistController.isPresent()) {

@ -125,7 +125,7 @@ public class PermAddAccountsToAllowlistTest {
final Throwable thrown = catchThrowable(() -> method.response(request));
assertThat(thrown)
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid accounts list parameter");
.hasMessage("Invalid accounts list parameter (index 0)");
}
private JsonRpcRequestContext request(final List<String> accounts) {

@ -126,7 +126,7 @@ public class PermRemoveAccountsFromAllowlistTest {
final Throwable thrown = catchThrowable(() -> method.response(request));
assertThat(thrown)
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid accounts list parameter");
.hasMessage("Invalid accounts list parameter (index 0)");
}
private JsonRpcRequestContext request(final List<String> accounts) {

Loading…
Cancel
Save