Commit 8e73ed24 by Shwetha G S

Merge pull request #68 from hortonworks/ISSUE67

Add response body to MetadataServiceException
parents 8ba831bc 8ee845be
...@@ -250,7 +250,8 @@ public class MetadataServiceClient { ...@@ -250,7 +250,8 @@ public class MetadataServiceClient {
throw new MetadataServiceException(api, e); throw new MetadataServiceException(api, e);
} }
} }
throw new MetadataServiceException(api, clientResponse.getClientResponseStatus());
throw new MetadataServiceException(api, clientResponse);
} }
private JSONObject callAPI(API api, Object requestObject, private JSONObject callAPI(API api, Object requestObject,
......
...@@ -27,10 +27,12 @@ public class MetadataServiceException extends Exception { ...@@ -27,10 +27,12 @@ public class MetadataServiceException extends Exception {
super("Metadata service API " + api + " failed", e); super("Metadata service API " + api + " failed", e);
} }
public MetadataServiceException(MetadataServiceClient.API api, ClientResponse.Status status) { public MetadataServiceException(MetadataServiceClient.API api, ClientResponse response) {
super("Metadata service API " + api + " failed with status " + status.getStatusCode() super("Metadata service API " + api + " failed with status " +
+ "(" + status.getReasonPhrase() + ")"); response.getClientResponseStatus().getStatusCode() + "(" +
this.status = status; response.getClientResponseStatus().getReasonPhrase() + ") Response Body (" +
response.getEntity(String.class) + ")");
this.status = response.getClientResponseStatus();
} }
public MetadataServiceException(Exception e) { 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