hyperwallet/java-sdk

Java SDK Attempt to decrypt error 500 & then lose original error message

Opened this issue · 0 comments

There is a bit of a red herring in that the processResponse of the HyperwalletApiClient (Hyperwallet SDK) will attempt to decrypt the error 500 and then lose the original error message.
The message did actually say that it could not find the key to use, but when the response comes back, it tries to decrypt the body then throws an exception that the body does not contain the dots!

Might be worth a future request to not attempt to decrypt error 500 responses!

  protected <T> T processResponse(final Response response, final Class<T> type)
            throws ParseException, JOSEException, IOException {
        checkErrorResponse(response);
        checkResponseHeader(response);
        **if (response.getResponseCode() == 204) {
            return convert("{}", type);
        } else {
            return convert(decryptResponse(response.getBody()), type);
        }**
    }

See file : src/main/java/com/hyperwallet/clientsdk/util/HyperwalletApiClient.java