You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/03/10 22:07:25 UTC

[libcloud] 02/05: Make sure ValueError is correctly thrown instead of re-throwing it as MalformedResponseError.

This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 0f231dba98c1e04628f26b04f87e4b5e36a9b25c
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Tue Mar 10 22:58:54 2020 +0100

    Make sure ValueError is correctly thrown instead of re-throwing it as
    MalformedResponseError.
---
 libcloud/common/openstack_identity.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py
index 3ca2e89..1fd6300 100644
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -1563,9 +1563,11 @@ class OpenStackIdentity_3_0_Connection_OIDC_access_token(
                         if self.domain_name in [project['name'],
                                                 project['id']]:
                             return project['id']
-                    raise ValueError('Project %s not found' % self.domain_name)
+                    raise ValueError('Project %s not found' % (self.domain_name))
                 else:
                     return body['projects'][0]['id']
+            except ValueError as e:
+                raise e
             except Exception as e:
                 raise MalformedResponseError('Failed to parse JSON', e)
         else: