diff options
author | Frederick Yin <fkfd@fkfd.me> | 2021-10-27 22:05:07 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2021-10-27 22:05:07 +0800 |
commit | 40ecb7b06b08f1e803d3ae4d59eeaf9bebcd6491 (patch) | |
tree | 7814a7a217c7b0762fa5e8d7f39c592c7ba7fea3 /jimbrella | |
parent | 106202912286b4b98ede620a83ae1dd89d42d225 (diff) |
Define UsernameTakenError
Diffstat (limited to 'jimbrella')
-rw-r--r-- | jimbrella/exceptions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jimbrella/exceptions.py b/jimbrella/exceptions.py index ad92b50..c0cc055 100644 --- a/jimbrella/exceptions.py +++ b/jimbrella/exceptions.py @@ -25,3 +25,12 @@ class UmbrellaValueError(Exception): self.field = field self.message = f"Invalid field: {field}." super().__init__(self.message) + + +class UsernameTakenError(Exception): + """For when a username to be registered with is already taken.""" + + def __init__(self, username: str): + self.username = username + self.message = f"Username {username} is already taken." + super().__init__(self.message) |