Return-Path: X-Original-To: apmail-libcloud-commits-archive@www.apache.org Delivered-To: apmail-libcloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2735C10AAE for ; Tue, 22 Oct 2013 09:17:45 +0000 (UTC) Received: (qmail 19987 invoked by uid 500); 22 Oct 2013 09:17:44 -0000 Delivered-To: apmail-libcloud-commits-archive@libcloud.apache.org Received: (qmail 19938 invoked by uid 500); 22 Oct 2013 09:17:42 -0000 Mailing-List: contact commits-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list commits@libcloud.apache.org Received: (qmail 19920 invoked by uid 99); 22 Oct 2013 09:17:41 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Oct 2013 09:17:41 +0000 Date: Tue, 22 Oct 2013 09:17:41 +0000 (UTC) From: "Jayy Vis (JIRA)" To: commits@libcloud.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LIBCLOUD-412) Using ProviderError type in drivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LIBCLOUD-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13801633#comment-13801633 ] 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: 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)