[
https://issues.apache.org/jira/browse/LIBCLOUD-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13801633#comment-13801633
]
Jayy Vis edited comment on LIBCLOUD-412 at 10/22/13 9:17 AM:
-------------------------------------------------------------
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]
was (Author: jayyy0v):
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: https://issues.apache.org/jira/browse/LIBCLOUD-412
> 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 (https://issues.apache.org/jira/browse/LIBCLOUD-331).
> libcloud.common.base.Response and all the drivers should be fixed to raise
> this error type.
--
This message was sent by Atlassian JIRA
(v6.1#6144)