Missing users now raise a UserNotFoundException
A missing user in a cognito user pool has raises a UserNotFoundException, not a ResourceNotFoundException. This commit corrects the behaviour so that the correct exception is raised
This commit is contained in:
parent
2aad36f984
commit
2d2708cfd7
2 changed files with 19 additions and 3 deletions
|
|
@ -383,7 +383,7 @@ class CognitoIdpBackend(BaseBackend):
|
|||
raise ResourceNotFoundError(user_pool_id)
|
||||
|
||||
if username not in user_pool.users:
|
||||
raise ResourceNotFoundError(username)
|
||||
raise UserNotFoundError(username)
|
||||
|
||||
return user_pool.users[username]
|
||||
|
||||
|
|
@ -408,7 +408,7 @@ class CognitoIdpBackend(BaseBackend):
|
|||
raise ResourceNotFoundError(user_pool_id)
|
||||
|
||||
if username not in user_pool.users:
|
||||
raise ResourceNotFoundError(username)
|
||||
raise UserNotFoundError(username)
|
||||
|
||||
del user_pool.users[username]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue