blob: 3c8f6afb4c13d3c92e9514b5e70dd045f6982ef6 (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
"""
Generic error hierarchy
Leap/EIP exceptions used for exception handling,
logging, and notifying user of errors
during leap operation.
Exception hierarchy
-------------------
All EIP Errors must inherit from EIPClientError (note: move that to
a more generic LEAPClientBaseError).
Exception attributes and their meaning/uses
-------------------------------------------
* critical: if True, will abort execution prematurely,
after attempting any cleaning
action.
* failfirst: breaks any error_check loop that is examining
the error queue.
* message: the message that will be used in the __repr__ of the exception.
* usermessage: the message that will be passed to user in ErrorDialogs
in Qt-land.
TODO:
* EIPClientError:
Should inherit from LeapException
and move basic attrs there
* gettext / i18n for user messages.
"""
class EIPClientError(Exception):
"""
base EIPClient exception
"""
critical = False
class CriticalError(EIPClientError):
"""
we cannot do anything about it, sorry
"""
critical = True
failfirst = True
class Warning(EIPClientError):
"""
just that, warnings
"""
pass
class EIPNoPolkitAuthAgentAvailable(CriticalError):
message = "No polkit authentication agent could be found"
usermessage = ("We could not find any authentication "
"agent in your system.<br/>"
"Make sure you have "
"<b>polkit-gnome-authentication-agent-1</b> "
"running and try again.")
class EIPNoPkexecAvailable(Warning):
message = "No pkexec binary found"
usermessage = ("We could not find <b>pkexec</b> in your "
"system.<br/> Do you want to try "
"<b>setuid workaround</b>? "
"(<i>DOES NOTHING YET</i>)")
failfirst = True
class EIPNoCommandError(EIPClientError):
message = "no suitable openvpn command found"
usermessage = ("No suitable openvpn command found. "
"<br/>(Might be a permissions problem)")
#
# errors still needing some love
#
class EIPInitNoKeyFileError(CriticalError):
message = "No vpn keys found in the expected path"
usermessage = "We could not find your eip certs in the expected path"
class EIPInitBadKeyFilePermError(Warning):
# I don't know if we should be telling user or not,
# we try to fix permissions and should only re-raise
# if permission check failed.
pass
class EIPInitNoProviderError(EIPClientError):
pass
class EIPInitBadProviderError(EIPClientError):
pass
class EIPConfigurationError(EIPClientError):
pass
#
# Errors that probably we don't need anymore
# chase down for them and check.
#
class MissingSocketError(Exception):
pass
class ConnectionRefusedError(Exception):
pass
class EIPMissingDefaultProvider(Exception):
pass
|