1 # -*- coding: UTF-8 -*- |
1 # -*- coding: UTF-8 -*- |
2 # Copyright (c) 2007 - 2010, Pascal Volk |
2 # Copyright (c) 2007 - 2010, Pascal Volk |
3 # See COPYING for distribution information. |
3 # See COPYING for distribution information. |
4 |
4 |
5 """Exception classes for Virtual Mail Manager""" |
5 """ |
|
6 VirtualMailManager.Exceptions |
|
7 |
|
8 VMM's Exception classes |
|
9 """ |
|
10 |
6 |
11 |
7 class VMMException(Exception): |
12 class VMMException(Exception): |
8 """Exception class for VirtualMailManager exceptions""" |
13 """Exception base class for VirtualMailManager exceptions""" |
|
14 |
9 def __init__(self, msg, code): |
15 def __init__(self, msg, code): |
10 Exception.__init__(self, msg) |
16 Exception.__init__(self, msg) |
11 self._code = int(code) |
17 self._code = int(code) |
12 ### for older python versions, like py 2.4.4 on OpenBSD 4.2 |
18 ### for older python versions, like py 2.4.4 on OpenBSD 4.2 |
13 if not hasattr(self, 'message'): |
19 if not hasattr(self, 'message'): |
19 |
25 |
20 def code(self): |
26 def code(self): |
21 """Returns the numeric exception error code.""" |
27 """Returns the numeric exception error code.""" |
22 return self._code |
28 return self._code |
23 |
29 |
|
30 |
24 class VMMConfigException(VMMException): |
31 class VMMConfigException(VMMException): |
25 """Exception class for Configurtion exceptions""" |
32 """Exception class for configuration exceptions""" |
26 def __init__(self, msg, code): |
33 pass |
27 VMMException.__init__(self, msg, code) |
34 |
28 |
35 |
29 class VMMPermException(VMMException): |
36 class VMMPermException(VMMException): |
30 """Exception class for permissions exceptions""" |
37 """Exception class for permissions exceptions""" |
31 def __init__(self, msg, code): |
38 pass |
32 VMMException.__init__(self, msg, code) |
39 |
33 |
40 |
34 class VMMNotRootException(VMMException): |
41 class VMMNotRootException(VMMException): |
35 """Exception class for non-root exceptions""" |
42 """Exception class for non-root exceptions""" |
36 def __init__(self, msg, code): |
43 pass |
37 VMMException.__init__(self, msg, code) |
44 |
38 |
45 |
39 class VMMDomainException(VMMException): |
46 class VMMDomainException(VMMException): |
40 """Exception class for Domain exceptions""" |
47 """Exception class for Domain exceptions""" |
41 def __init__(self, msg, code): |
48 pass |
42 VMMException.__init__(self, msg, code) |
49 |
43 |
50 |
44 class VMMAliasDomainException(VMMException): |
51 class VMMAliasDomainException(VMMException): |
45 """Exception class for AliasDomain exceptions""" |
52 """Exception class for AliasDomain exceptions""" |
46 def __init__(self, msg, code): |
53 pass |
47 VMMException.__init__(self, msg, code) |
54 |
48 |
55 |
49 class VMMAccountException(VMMException): |
56 class VMMAccountException(VMMException): |
50 """Exception class for Account exceptions""" |
57 """Exception class for Account exceptions""" |
51 def __init__(self, msg, code): |
58 pass |
52 VMMException.__init__(self, msg, code) |
59 |
53 |
60 |
54 class VMMAliasException(VMMException): |
61 class VMMAliasException(VMMException): |
55 """Exception class for Alias exceptions""" |
62 """Exception class for Alias exceptions""" |
56 def __init__(self, msg, code): |
63 pass |
57 VMMException.__init__(self, msg, code) |
64 |
58 |
65 |
59 class VMMEmailAddressException(VMMException): |
66 class VMMEmailAddressException(VMMException): |
60 """Exception class for EmailAddress exceptions""" |
67 """Exception class for EmailAddress exceptions""" |
61 def __init__(self, msg, code): |
68 pass |
62 VMMException.__init__(self, msg, code) |
69 |
63 |
70 |
64 class VMMMailLocationException(VMMException): |
71 class VMMMailLocationException(VMMException): |
65 """Exception class for MailLocation exceptions""" |
72 """Exception class for MailLocation exceptions""" |
66 def __init__(self, msg, code): |
73 pass |
67 VMMException.__init__(self, msg, code) |
74 |
68 |
75 |
69 class VMMRelocatedException(VMMException): |
76 class VMMRelocatedException(VMMException): |
70 """Exception class for Relocated exceptions""" |
77 """Exception class for Relocated exceptions""" |
71 def __init__(self, msg, code): |
78 pass |
72 VMMException.__init__(self, msg, code) |
79 |
73 |
80 |
74 class VMMTransportException(VMMException): |
81 class VMMTransportException(VMMException): |
75 """Exception class for Transport exceptions""" |
82 """Exception class for Transport exceptions""" |
76 def __init__(self, msg, code): |
83 pass |
77 VMMException.__init__(self, msg, code) |
|