libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jayy Vis (JIRA)" <>
Subject [jira] [Commented] (LIBCLOUD-412) Using ProviderError type in drivers
Date Tue, 22 Oct 2013 09:17:41 GMT


Jayy Vis commented on LIBCLOUD-412:

Changing libcloud.common.base.Response constructor to raise ProviderError instead of Exception
breaks few test cases (attached the report) that validates exception messages.

@@ -90,7 +91,7 @@ class Response(object):
         self.connection = connection
         if not self.success():
-            raise Exception(self.parse_error())
+            raise ProviderError(value=self.parse_error(), http_code=self.status)
         self.object = self.parse_body()

The failed test cases are fetching exception message as e.args\[0] and resulting in IndexError:
tuple index out of range. This is due to the fact that we override __init__ in our custom
error types LibcloudError, MalformedResponseError, ProviderError and expose the exception
details with named fields like value, driver, body, http_code.

I think we should fix the test cases to validate for provider error type and retrieve the
err message as e.value instead of e.args\[0]

> Using ProviderError type in drivers
> -----------------------------------
>                 Key: LIBCLOUD-412
>                 URL:
>             Project: Libcloud
>          Issue Type: Improvement
>            Reporter: Jayy Vis
>            Priority: Minor
>         Attachments: failed-tests.txt
> We have created ProviderError type to classify all the error responses given by cloud
providers (
> libcloud.common.base.Response and all the drivers should be fixed to raise this error

This message was sent by Atlassian JIRA

View raw message