Add exception message to invalid cred field
This commit adds a new error message to the InvalidCredentials exception raised when creating a new credentials object. Previously it would just fail saying invalid credentials which wasn't particularly useful for debugging what about the fields passed in was invalid. The new error message will inform the user which key was the cause of the error. Change-Id: I49941321db7d6259080d706b687ac27173a3bffe
This commit is contained in:
@@ -528,7 +528,8 @@ class Credentials(object):
|
||||
if key in self.ATTRIBUTES:
|
||||
setattr(self, key, attr[key])
|
||||
else:
|
||||
raise exceptions.InvalidCredentials
|
||||
msg = '%s is not a valid attr for %s' % (key, self.__class__)
|
||||
raise exceptions.InvalidCredentials(msg)
|
||||
|
||||
def __str__(self):
|
||||
"""Represent only attributes included in self.ATTRIBUTES"""
|
||||
|
Reference in New Issue
Block a user