added context to exception

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1468 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-06-27 17:15:36 +00:00
parent 2a9ca61b36
commit 7b1f565308
1 changed files with 6 additions and 4 deletions

View File

@ -26,6 +26,7 @@ package org.jclouds.http.internal;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.annotation.Resource;
@ -62,12 +63,12 @@ public abstract class BaseHttpFutureCommandClient<Q> implements HttpFutureComman
Q nativeRequest = null;
try {
for (HttpRequestFilter filter : requestFilters) {
filter.filter(request);
}
HttpResponse response = null;
for (;;) {
logger.trace("%s - converting request %s", request.getEndPoint(), request);
for (HttpRequestFilter filter : requestFilters) {
filter.filter(request);
}
nativeRequest = convert(request);
response = invoke(nativeRequest);
int statusCode = response.getStatusCode();
@ -84,7 +85,8 @@ public abstract class BaseHttpFutureCommandClient<Q> implements HttpFutureComman
}
}
} catch (Exception e) {
command.setException(e);
command.setException(new ExecutionException(String.format("error invoking request %s",
request), e));
} finally {
cleanup(nativeRequest);
}