Commit 8e73ed24 by Shwetha G S

Merge pull request #68 from hortonworks/ISSUE67

Add response body to MetadataServiceException
No related merge requests found
......@@ -250,7 +250,8 @@ public class MetadataServiceClient {
throw new MetadataServiceException(api, e);
}
}
throw new MetadataServiceException(api, clientResponse.getClientResponseStatus());
throw new MetadataServiceException(api, clientResponse);
}
private JSONObject callAPI(API api, Object requestObject,
......
......@@ -27,10 +27,12 @@ public class MetadataServiceException extends Exception {
super("Metadata service API " + api + " failed", e);
}
public MetadataServiceException(MetadataServiceClient.API api, ClientResponse.Status status) {
super("Metadata service API " + api + " failed with status " + status.getStatusCode()
+ "(" + status.getReasonPhrase() + ")");
this.status = status;
public MetadataServiceException(MetadataServiceClient.API api, ClientResponse response) {
super("Metadata service API " + api + " failed with status " +
response.getClientResponseStatus().getStatusCode() + "(" +
response.getClientResponseStatus().getReasonPhrase() + ") Response Body (" +
response.getEntity(String.class) + ")");
this.status = response.getClientResponseStatus();
}
public MetadataServiceException(Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment