Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Commit

Permalink
better exception message for user api
Browse files Browse the repository at this point in the history
  • Loading branch information
inkhey committed Jun 7, 2018
1 parent 2f98c67 commit 6084169
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tracim/lib/core/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_current_user(self) -> User:
Get current_user
"""
if not self._user:
raise UserDoesNotExist()
raise UserDoesNotExist('There is no current user')
return self._user

def get_all(self) -> typing.Iterable[User]:
Expand Down Expand Up @@ -102,9 +102,9 @@ def authenticate_user(self, email: str, password: str) -> User:
if user.validate_password(password):
return user
else:
raise WrongUserPassword()
except (WrongUserPassword, UserDoesNotExist):
raise AuthenticationFailed()
raise WrongUserPassword('User "{}" password is incorrect'.format(email)) # nopep8
except (WrongUserPassword, UserDoesNotExist) as exc:
raise AuthenticationFailed('User "{}" authentication failed'.format(email)) from exc # nopep8

# Actions

Expand Down

0 comments on commit 6084169

Please sign in to comment.