Skip to content

Commit

Permalink
5098: Update already merged RpcErrorTypes to include index in excepti…
Browse files Browse the repository at this point in the history
…on message (#7420)

Signed-off-by: Matilda Clerke <[email protected]>
  • Loading branch information
Matilda-Clerke authored Aug 2, 2024
1 parent a6a0271 commit 4199952
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void whenEmptyParamOnRequestShouldThrowInvalidJsonRpcException() {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void whenEmptyParamOnRequestShouldThrowInvalidJsonRpcException() {
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) {
Expand Down

0 comments on commit 4199952

Please sign in to comment.