VirtualMailManager/Exceptions.py
changeset 48 0d5f58f8b8f5
parent 47 191d5a5adc4a
child 55 15c873f94ba6
equal deleted inserted replaced
47:191d5a5adc4a 48:0d5f58f8b8f5
    13 __revision__ = 'rev '+'$Rev$'.split()[1]
    13 __revision__ = 'rev '+'$Rev$'.split()[1]
    14 __date__ = '$Date$'.split()[1]
    14 __date__ = '$Date$'.split()[1]
    15 
    15 
    16 class VMMException(Exception):
    16 class VMMException(Exception):
    17     """Exception class for VirtualMailManager exceptions"""
    17     """Exception class for VirtualMailManager exceptions"""
    18     def __init__(self, msg):
    18     def __init__(self, msg, code):
    19         Exception.__init__(self, msg)
    19         Exception.__init__(self, msg)
       
    20         self._code = int(code)
    20 
    21 
    21 class VMMConfigException(Exception):
    22     def msg(self):
       
    23         """Returns the exception message."""
       
    24         return self.message
       
    25 
       
    26     def code(self):
       
    27         """Returns the numeric exception error code."""
       
    28         return self._code
       
    29 
       
    30 class VMMConfigException(VMMException):
    22     """Exception class for Configurtion exceptions"""
    31     """Exception class for Configurtion exceptions"""
    23     def __init__(self, msg):
    32     def __init__(self, msg, code):
    24         Exception.__init__(self, msg)
    33         VMMException.__init__(self, msg, code)
    25 
    34 
    26 class VMMPermException(Exception):
    35 class VMMPermException(VMMException):
    27     """Exception class for permissions exceptions"""
    36     """Exception class for permissions exceptions"""
    28     pass
    37     def __init__(self, msg, code):
       
    38         VMMException.__init__(self, msg, code)
    29 
    39 
    30 class VMMNotRootException(Exception):
    40 class VMMNotRootException(VMMException):
    31     """Exception class for non-root exceptions"""
    41     """Exception class for non-root exceptions"""
    32     def __init__(self, msg):
    42     def __init__(self, msg, code):
    33         Exception.__init__(self, msg)
    43         VMMException.__init__(self, msg, code)
    34 
    44 
    35 class VMMDomainException(VMMException):
    45 class VMMDomainException(VMMException):
    36     """Exception class for Domain exceptions"""
    46     """Exception class for Domain exceptions"""
    37     def __init__(self, msg):
    47     def __init__(self, msg, code):
    38         VMMException.__init__(self, msg)
    48         VMMException.__init__(self, msg, code)
    39 
    49 
    40 class VMMDomainAliasException(VMMException):
    50 class VMMDomainAliasException(VMMException):
    41     """Exception class for DomainAlias exceptions"""
    51     """Exception class for DomainAlias exceptions"""
    42     def __init__(self, msg):
    52     def __init__(self, msg, code):
    43         VMMException.__init__(self, msg)
    53         VMMException.__init__(self, msg, code)
    44 
    54 
    45 class VMMAccountException(VMMException):
    55 class VMMAccountException(VMMException):
    46     """Exception class for Account exceptions"""
    56     """Exception class for Account exceptions"""
    47     def __init__(self, msg):
    57     def __init__(self, msg, code):
    48         VMMException.__init__(self, msg)
    58         VMMException.__init__(self, msg, code)
    49 
    59 
    50 class VMMAliasException(VMMException):
    60 class VMMAliasException(VMMException):
    51     """Exception class for Alias exceptions"""
    61     """Exception class for Alias exceptions"""
    52     def __init__(self, msg):
    62     def __init__(self, msg, code):
    53         VMMException.__init__(self, msg)
    63         VMMException.__init__(self, msg, code)
    54 
    64 
    55 class VMMMailLocationException(VMMException):
    65 class VMMMailLocationException(VMMException):
    56     """Exception class for MailLocation exceptions"""
    66     """Exception class for MailLocation exceptions"""
    57     def __init__(self, msg):
    67     def __init__(self, msg, code):
    58         VMMException.__init__(self, msg)
    68         VMMException.__init__(self, msg, code)
    59 
    69 
    60 class VMMTransportException(VMMException):
    70 class VMMTransportException(VMMException):
    61     """Exception class for Transport exceptions"""
    71     """Exception class for Transport exceptions"""
    62     def __init__(self, msg):
    72     def __init__(self, msg, code):
    63         VMMException.__init__(self, msg)
    73         VMMException.__init__(self, msg, code)
    64 
    74