> @@ -64,6 +65,8 @@ public void handleError(HttpCommand command, HttpResponse 
> response) {
>                       exception = new ResourceNotFoundException(message, 
> exception);
>                    } else if (message.indexOf("currently an active 
> transaction") != -1) {
>                       exception = new IllegalStateException(message, 
> exception);
> +                  } else if 
> (message.indexOf("SoftLayer_Exception_Order_Item_Duplicate") != -1) {
> +                     exception = new 
> SoftLayerOrderItemDuplicateException(command.getCurrentRequest(), message);

I think there is no point in providing the entire json string in a custom field 
of your exception. If the json error is not parsed, and its fields can not be 
easily accessed by users, then there is no point to store it in dedicated 
fields. I'd remove the fields of the custom exception class, and just propagate 
the `HttpResponseException`:
```java
new SoftLayerOrderItemDuplicateException(message, exception);
```
Or you can parse the json (using the jclouds json integration is just a one 
liner), and properly populate the error message and error code in the exception 
class.

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

Reply via email to