-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomExceptions.py
33 lines (23 loc) · 1.03 KB
/
CustomExceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class MatchNotFound(Exception):
def __init__(self,username, message='No client with username: '):
self.username = username
self.message = message
# Call the base class constructor with the parameters it needs
super(MatchNotFound, self).__init__(message + username)
def __str__(self):
return self.message + self.username
class IncorrectLogin(Exception):
def __init__(self, message='username or password is incorrect, please try again'):
self.message = message
# Call the base class constructor with the parameters it needs
super(IncorrectLogin, self).__init__(message)
def __str__(self):
return self.message
class NonUniqueValue(Exception):
def __init__(self, value, message=' already exists'):
self.value = value
self.message = message
# Call the base class constructor with the parameters it needs
super(NonUniqueValue, self).__init__(value + message)
def __str__(self):
return self.value + self.message