> @@ -54,7 +55,17 @@ public void handleError(HttpCommand command, HttpResponse 
> response) {
>                 exception = new IllegalArgumentException(message);
>                 break;
>              case 404:
> -               exception = new ResourceNotFoundException(message);
> +               if (command.getCurrentRequest().getMethod().equals("DELETE")) 
> {
> +                  if 
> (command.getCurrentRequest().getEndpoint().getPath().startsWith("/" + 
> EtcdApiMetadata.API_VERSION + "/keys") &&
> +                        message.contains("Key not found")) {
> +                        exception = new ResourceNotFoundException("Could not 
> find key to delete: message=" + message, new HttpResponseException(command, 
> response, message));
> +                  }
> +               } else if 
> (command.getCurrentRequest().getMethod().equals("GET")) {
> +                  if 
> (command.getCurrentRequest().getEndpoint().getPath().startsWith("/" + 
> EtcdApiMetadata.API_VERSION + "/keys") &&
> +                        message.contains("Key not found")) {
> +                        exception = new ResourceNotFoundException("Could not 
> find key: message=" + message, new HttpResponseException(command, response, 
> message));
> +                  }

This seems inconsistent. the methods are already configured with a fallback 
that looks for the `Could not find key` string. Why should that be treated in 
the fallback and this message in the error handler? Are there really two 
different  messages to describe the same error?

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

Reply via email to