Commit 8ee845be by Aaron Dossett

Add response body to MetadataServiceException

reformat and remove unused constructor MetadataServiceException should report response body and response status
parent 5fda7b70
No related merge requests found
...@@ -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