-
Notifications
You must be signed in to change notification settings - Fork 390
/
exceptions.py
114 lines (79 loc) · 2.38 KB
/
exceptions.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
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
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
# Base class of all exceptions in VNC
class VncError(Exception):
pass
# end class VncError
class TimeOutError(VncError):
def __init__(self, code):
self._reason_code = code
# end __init__
def __str__(self):
return 'Timed out due to: %s' % (str(self._reason_code))
# end __str__
# end class TimeOutError
class BadRequest(Exception):
def __init__(self, status_code, content):
self.status_code = status_code
self.content = content
# end __init__
def __str__(self):
return 'HTTP Status: %s Content: %s' % (self.status_code, self.content)
# end __str__
# end class BadRequest
class NoIdError(VncError):
def __init__(self, unknown_id):
self._unknown_id = unknown_id
# end __init__
def __str__(self):
return 'Unknown id: %s' % (self._unknown_id)
# end __str__
# end class NoIdError
class MaxRabbitPendingError(VncError):
def __init__(self, npending):
self._npending = npending
# end __init__
def __str__(self):
return 'Too many pending updates to RabbitMQ: %s' % (self._npending)
# end __str__
# end class MaxRabbitPendingError
class ResourceExistsError(VncError):
def __init__(self, eexists_fq_name, eexists_id):
self._eexists_fq_name = eexists_fq_name
self._eexists_id = eexists_id
# end __init__
def __str__(self):
return 'FQ Name: %s exists already with ID: %s' \
% (self._eexists_fq_name, self._eexists_id)
# end __str__
# end class ResourceExistsError
class PermissionDenied(VncError):
pass
# end class PermissionDenied
class RefsExistError(VncError):
pass
# end class RefsExistError
class ResourceExhaustionError(VncError):
pass
# end class ResourceExhaustionError
class NoUserAgentKey(VncError):
pass
# end class NoUserAgentKey
class UnknownAuthMethod(VncError):
pass
# end class UnknownAuthMethod
class HttpError(VncError):
def __init__(self, status_code, content):
self.status_code = status_code
self.content = content
# end __init__
def __str__(self):
return 'HTTP Status: %s Content: %s' % (self.status_code, self.content)
# end __str__
# end class HttpError
class AmbiguousParentError(VncError):
pass
class InvalidSessionID(VncError):
pass
# end InvalidSessionID