> +import org.jclouds.rest.ResourceNotFoundException;
> +
> +/**
> + * Parse ProfitBricks API errors and set the appropriate exception.
> + */
> +@Singleton
> +public class ProfitBricksHttpErrorHandler implements HttpErrorHandler {
> +
> + @Override
> + public void handleError(final HttpCommand command, final HttpResponse
> response) {
> + Exception exception = null;
> + try {
> + String message = String.format("%s -> %s",
> command.getCurrentRequest().getRequestLine(),
> + response.getStatusLine());
> + // TODO: Actual API response codes are known after parsing the SOAP
> response body.
> + // Current impl always returns 500
*sigh* SOAP APIs suck...
The DigitalOcean v1 API presents a similar problem: the body has to be read to
actually know if the request has failed. You can look at how it addresses that
by using a custom http driver to parse the body and populate a proper response
code
[here](https://github.com/jclouds/jclouds-labs/blob/master/digitalocean/src/main/java/org/jclouds/digitalocean/http/ResponseStatusFromPayloadHttpCommandExecutorService.java),
and how that driver is configured
[here](https://github.com/jclouds/jclouds-labs/blob/master/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanHttpApiModule.java#L56-L64).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/72/files#r22134229