Skip to content

Commit

Permalink
5098 branch 23 rename is complete transaction (hyperledger#7479)
Browse files Browse the repository at this point in the history
* 5098: Add RpcErrorTypes
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

---------

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda-Clerke <matilda.clerke@consensys.net>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Ade Lucas <ade.lucas@consensys.net>
  • Loading branch information
2 people authored and cloudspores committed Aug 22, 2024
1 parent bd850c6 commit e741dc3
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public void missingHashesOrTransactionParameter() {

assertThat(thrown)
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is transaction complete parameter (index 1)");
.hasMessage("Invalid return complete transaction parameter (index 1)");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public JsonRpcResponse process(
case INVALID_GAS_PRICE_PARAMS:
case INVALID_HASH_RATE_PARAMS:
case INVALID_ID_PARAMS:
case INVALID_IS_TRANSACTION_COMPLETE_PARAMS:
case INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS:
case INVALID_LOG_FILTER_PARAMS:
case INVALID_LOG_LEVEL_PARAMS:
case INVALID_MAX_RESULTS_PARAMS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 1)",
"Invalid transaction trace parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected TraceOptions getTraceOptions(final JsonRpcRequestContext requestContex
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 2)",
"Invalid transaction trace parameter (index 2)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ private boolean isCompleteTransactions(final JsonRpcRequestContext requestContex
return requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid is complete transaction parameter (index 1)",
RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS,
"Invalid return complete transaction parameter (index 1)",
RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS,
e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ private boolean isCompleteTransactions(final JsonRpcRequestContext request) {
return request.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid is transaction complete parameter (index 1)",
RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS,
"Invalid return complete transaction parameter (index 1)",
RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS,
e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
transactionHash = requestContext.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction has parameter (index 0)",
"Invalid transaction hash parameter (index 0)",
RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS,
e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public enum RpcErrorType implements RpcMethodError {
INVALID_GAS_PRICE_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid gas price params"),
INVALID_HASH_RATE_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid hash rate params"),
INVALID_ID_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid ID params"),
INVALID_IS_TRANSACTION_COMPLETE_PARAMS(
INVALID_PARAMS_ERROR_CODE, "Invalid is transaction complete params"),
INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS(
INVALID_PARAMS_ERROR_CODE, "Invalid return complete transaction params"),
INVALID_LOG_FILTER_PARAMS(INVALID_PARAMS_ERROR_CODE, "Invalid log filter params"),
INVALID_LOG_LEVEL_PARAMS(
INVALID_PARAMS_ERROR_CODE, "Invalid log level params (missing or incorrect)"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ public void getBlockByHashWithMissingBooleanParameter() throws Exception {
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final RpcErrorType expectedError = RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS;
final RpcErrorType expectedError = RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS;
testHelper.assertValidJsonRpcError(
json, id, expectedError.getCode(), expectedError.getMessage());
}
Expand Down Expand Up @@ -854,7 +854,7 @@ public void getBlockByHashWithInvalidBooleanParameter() throws Exception {
assertThat(resp.code()).isEqualTo(200);
// Check general format of result
final JsonObject json = new JsonObject(resp.body().string());
final RpcErrorType expectedError = RpcErrorType.INVALID_IS_TRANSACTION_COMPLETE_PARAMS;
final RpcErrorType expectedError = RpcErrorType.INVALID_RETURN_COMPLETE_TRANSACTION_PARAMS;
testHelper.assertValidJsonRpcError(
json, id, expectedError.getCode(), expectedError.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void exceptionWhenNoHashSupplied() {
public void exceptionWhenNoBoolSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH)))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is complete transaction parameter (index 1)");
.hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries);
}

Expand All @@ -85,7 +85,7 @@ public void exceptionWhenHashParamInvalid() {
public void exceptionWhenBoolParamInvalid() {
assertThatThrownBy(() -> method.response(requestWithParams(ZERO_HASH, "maybe")))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is complete transaction parameter (index 1)");
.hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void exceptionWhenNoNumberSupplied() {
public void exceptionWhenNoBoolSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams("0")))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is transaction complete parameter (index 1)");
.hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries);
}

Expand All @@ -137,7 +137,7 @@ public void exceptionWhenNumberParamInvalid() {
public void exceptionWhenBoolParamInvalid() {
assertThatThrownBy(() -> method.response(requestWithParams("0", "maybe")))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Invalid is transaction complete parameter (index 1)");
.hasMessage("Invalid return complete transaction parameter (index 1)");
verifyNoMoreInteractions(blockchainQueries);
}

Expand Down

0 comments on commit e741dc3

Please sign in to comment.