Coverage for error.py: 80%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2error.py
4 This module contains the error classes.
5"""
6class AuthorisationError(Exception):
7 """
8 Exception raised for errors in authorisation
10 Attributes:
11 message -- explanation of the error
12 """
14 default_message = "User is not authorized"
16 def __init__(self, message=default_message):
17 self.message = message
18 super().__init__(self.message)
20 def __str__(self):
21 return self.message
23class HelpNotFoundError(Exception):
24 """
25 Exception raised for errors in help
27 Attributes:
28 message -- explanation of the error
29 """
31 default_message = "Help not found"
33 def __init__(self, message=default_message):
34 self.message = message
35 super().__init__(self.message)
37 def __str__(self):
38 return self.message
40class TimezoneNotFoundError(Exception):
41 """
42 Exception raised for errors in timezones
44 Attributes:
45 message -- explanation of the error
46 """
48 default_message = "Timezone not found"
50 def __init__(self, message=default_message):
51 self.message = message
52 super().__init__(self.message)
54 def __str__(self):
55 return self.message
57class ArgumentRequiredError(Exception):
58 """
59 Exception raised for when arguments are required
61 Attributes:
62 message -- explanation of the error
63 """
65 default_message = "Argument(s) required"
67 def __init__(self, message=default_message):
68 self.message = message
69 super().__init__(self.message)
71 def __str__(self):
72 return self.message
74class UnknownArgumentError(Exception):
75 """
76 Exception raised for errors in too many arguments
78 Attributes:
79 message -- explanation of the error
80 """
82 default_message = "Unknown argument(s)"
84 def __init__(self, message=default_message):
85 self.message = message
86 super().__init__(self.message)
88 def __str__(self):
89 return self.message