-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
51 lines (39 loc) · 1.2 KB
/
errors.py
File metadata and controls
51 lines (39 loc) · 1.2 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class Error(Exception):
pass
class WidgetTypeError(Error):
message = ""
def __init__(self, message):
self.message = message
super().__init__(self.message)
def __str__(self):
return f'The component type "{self.message}" is not a valid type'
class HotKeyTypeError(Error):
message = ""
default = ""
control = ""
def __init__(self, message, default, control):
self.message = message
self.default = default
self.control = control
super().__init__(self.message)
def __str__(self):
return (
f'The hotkey "{self.message}" is an invalid key. '
f'Using the default hotkey "{self.default}" '
f'for the control action "{self.control}"'
)
class ConfigValueError(Error):
key = ""
user = ""
default = ""
def __init__(self, key, user, default):
self.key = key
self.user = user
self.default = default
super().__init__(self.key)
def __str__(self):
return (
f'The configuration key "{self.key}" '
f'has an invalid value "{self.user}". '
f'Setting to the default value "{self.default}".'
)