> +import org.jclouds.http.HttpResponse;
> +import org.jclouds.http.HttpResponseException;
> +import org.jclouds.rest.AuthorizationException;
> +
> +import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
> +
> +public class MarconiErrorHandler implements HttpErrorHandler {
> +
> +   public void handleError(HttpCommand command, HttpResponse response) {
> +      // it is important to always read fully and close streams
> +      byte[] data = closeClientButKeepContentStream(response);
> +      String message = (data != null) ? new String(data) : null;
> +
> +      Exception exception = (message != null) ?
> +            new HttpResponseException(command, response, message) :
> +            new HttpResponseException(command, response);

This is much better. Will update in 
https://github.com/jclouds/jclouds-labs-openstack/pull/43

Thanks @demobox !

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/42/files#r7065785

Reply via email to