diff --git a/src/main/java/com/casper/sdk/exception/CasperClientException.java b/src/main/java/com/casper/sdk/exception/CasperClientException.java index 20204ee3a..309f2f679 100644 --- a/src/main/java/com/casper/sdk/exception/CasperClientException.java +++ b/src/main/java/com/casper/sdk/exception/CasperClientException.java @@ -9,15 +9,15 @@ */ public class CasperClientException extends RuntimeException { - public CasperClientException(CasperClientErrorData error) { - super(String.format("%s (code: %d)", error.getMessage(), error.getCode())); + public CasperClientException(final CasperClientErrorData error) { + super(String.format("%s (code: %d)%s", error.getMessage(), error.getCode(), error.getData() != null ? " " + error.getData() : "")); } - public CasperClientException(String message, Throwable cause) { + public CasperClientException(final String message, final Throwable cause) { super(message, cause); } - public CasperClientException(String message) { + public CasperClientException(final String message) { super(message); } } diff --git a/src/test/java/com/casper/sdk/service/CasperServiceTests.java b/src/test/java/com/casper/sdk/service/CasperServiceTests.java index 0e3b6db71..e9018a9e8 100644 --- a/src/test/java/com/casper/sdk/service/CasperServiceTests.java +++ b/src/test/java/com/casper/sdk/service/CasperServiceTests.java @@ -488,7 +488,7 @@ void getCasperClientExceptionExceptionBlockNotKnown() { .withBody("$.params.deploy_hash", "abc") .thenDispatch(getClass().getResource("/deploy-samples/info_get_deploy_error.json")); - final String expectedMessage = "Invalid params (code: -32602)"; + final String expectedMessage = "Invalid params (code: -32602) Failed to parse 'params' field: could not convert slice to array"; final CasperClientException casperClientException = assertThrows(CasperClientException.class, () -> casperServiceMock.getDeploy("abc"));