Duplicate user needs to be EntityAlreadyExists error code.

This commit is contained in:
Steve Pulec 2015-12-03 21:59:55 -05:00
parent 3a38a2a1a7
commit 587893f0c7
2 changed files with 3 additions and 3 deletions

View File

@ -13,9 +13,9 @@ class IAMNotFoundException(RESTError):
class IAMConflictException(RESTError): class IAMConflictException(RESTError):
code = 409 code = 409
def __init__(self, message): def __init__(self, code='Conflict', message=""):
super(IAMConflictException, self).__init__( super(IAMConflictException, self).__init__(
"Conflict", message) code, message)
class IAMReportNotPresentException(RESTError): class IAMReportNotPresentException(RESTError):

View File

@ -344,7 +344,7 @@ class IAMBackend(BaseBackend):
def create_user(self, user_name, path='/'): def create_user(self, user_name, path='/'):
if user_name in self.users: if user_name in self.users:
raise IAMConflictException("User {0} already exists".format(user_name)) raise IAMConflictException("EntityAlreadyExists", "User {0} already exists".format(user_name))
user = User(user_name, path) user = User(user_name, path)
self.users[user_name] = user self.users[user_name] = user