> @@ -70,6 +70,10 @@ public void handleError(HttpCommand command, HttpResponse 
> response) {
>                    if 
> (command.getCurrentRequest().getEndpoint().getPath().endsWith("/engines")) {
>                       exception = new HttpResponseException("Connection 
> refused registering docker daemon", command, response);
>                    }
> +               } else if 
> (command.getCurrentRequest().getMethod().equals("DELETE")) {
> +                  if 
> (command.getCurrentRequest().getEndpoint().getPath().endsWith("/servicekeys"))
>  {

Instead of "polluting" the error handler with custom checks of the invoked 
request path, it would be better to create a custom 
[Fallback](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/Fallback.java)
 and annotate the API methods so they use it.

This way the fallback for each method will be able to properly set the 
exception message and populate the right one: The error handler will no longer 
be coupled to the requests and will already receive the proper exception.

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

Reply via email to