better message in exception

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1978 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-10-14 01:14:21 +00:00
parent 03036ca1d0
commit ae1ad7498b

View File

@ -51,27 +51,26 @@ public class HttpResponseException extends RuntimeException {
this.content = content; this.content = content;
} }
public HttpResponseException(HttpCommand command, HttpResponse response, public HttpResponseException(HttpCommand command, HttpResponse response, Throwable cause) {
this(String.format("command: %1$s failed with response: %2$s", command.getRequest()
.getRequestLine(), response.getStatusLine()), command, response, cause);
}
public HttpResponseException(HttpCommand command, HttpResponse response, String content,
Throwable cause) { Throwable cause) {
this(String.format("command: %1$s failed with response: %2$s", command, response), command, this(String.format("command: %1$s failed with response: %2$s; content: [%3$s]", command
response, cause); .getRequest().getRequestLine(), response.getStatusLine()), command, response,
content, cause);
} }
public HttpResponseException(HttpCommand command, HttpResponse response, public HttpResponseException(String message, HttpCommand command, HttpResponse response) {
String content, Throwable cause) {
this(String.format("command: %1$s failed with response: %2$s; content: [%3$s]", command,
response), command, response, content, cause);
}
public HttpResponseException(String message, HttpCommand command,
HttpResponse response) {
super(message); super(message);
this.command = command; this.command = command;
this.response = response; this.response = response;
} }
public HttpResponseException(String message, HttpCommand command, public HttpResponseException(String message, HttpCommand command, HttpResponse response,
HttpResponse response, String content) { String content) {
super(message); super(message);
this.command = command; this.command = command;
this.response = response; this.response = response;
@ -79,14 +78,14 @@ public class HttpResponseException extends RuntimeException {
} }
public HttpResponseException(HttpCommand command, HttpResponse response) { public HttpResponseException(HttpCommand command, HttpResponse response) {
this(String.format("command: %1$s failed with response: %2$s", command, response), command, this(String.format("command: %1$s failed with response: %2$s", command.getRequest()
response); .getRequestLine(), response.getStatusLine()), command, response);
} }
public HttpResponseException(HttpCommand command, HttpResponse response, public HttpResponseException(HttpCommand command, HttpResponse response, String content) {
String content) { this(String.format("command: %1$s failed with response: %2$s; content: [%3$s]", command
this(String.format("command: %1$s failed with response: %2$s; content: [%3$s]", command, .getRequest().getRequestLine(), response.getStatusLine(), content), command,
response, content), command, response, content); response, content);
} }
public HttpCommand getCommand() { public HttpCommand getCommand() {