Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invokeAPI populate response object in ApiException for non successful… #71

Merged
merged 2 commits into from
Apr 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/com/docusign/esign/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,12 @@ public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Objec
ClientResponse response = getAPIResponse(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);

if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) {
throw new ApiException("Error while requesting server, received HTTP code: " + response.getStatusInfo().getStatusCode() + " / with response Body: " + response.getEntity(String.class));
String respBody = response.getEntity(String.class);
throw new ApiException(
response.getStatusInfo().getStatusCode(),
"Error while requesting server, received a non successful HTTP code " + response.getStatusInfo().getStatusCode() + " with response Body: '" + respBody + "'",
response.getHeaders(),
respBody);
}

statusCode = response.getStatusInfo().getStatusCode();
Expand Down