VirtualMailManager/Exceptions.py
branchv0.6.x
changeset 216 0c8c053b451c
parent 215 33f727efa7c4
child 217 eecd05e31517
equal deleted inserted replaced
215:33f727efa7c4 216:0c8c053b451c
     1 # -*- coding: UTF-8 -*-
       
     2 # Copyright (c) 2007 - 2010, Pascal Volk
       
     3 # See COPYING for distribution information.
       
     4 
       
     5 """
       
     6     VirtualMailManager.Exceptions
       
     7 
       
     8     VMM's Exception classes
       
     9 """
       
    10 
       
    11 
       
    12 class VMMException(Exception):
       
    13     """Exception base class for VirtualMailManager exceptions"""
       
    14 
       
    15     def __init__(self, msg, code):
       
    16         Exception.__init__(self, msg)
       
    17         self._code = int(code)
       
    18         ### for older python versions, like py 2.4.4 on OpenBSD 4.2
       
    19         if not hasattr(self, 'message'):
       
    20             self.message = msg
       
    21 
       
    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 
       
    31 class VMMConfigException(VMMException):
       
    32     """Exception class for configuration exceptions"""
       
    33     pass
       
    34 
       
    35 
       
    36 class VMMPermException(VMMException):
       
    37     """Exception class for permissions exceptions"""
       
    38     pass
       
    39 
       
    40 
       
    41 class VMMNotRootException(VMMException):
       
    42     """Exception class for non-root exceptions"""
       
    43     pass
       
    44 
       
    45 
       
    46 class VMMDomainException(VMMException):
       
    47     """Exception class for Domain exceptions"""
       
    48     pass
       
    49 
       
    50 
       
    51 class VMMAliasDomainException(VMMException):
       
    52     """Exception class for AliasDomain exceptions"""
       
    53     pass
       
    54 
       
    55 
       
    56 class VMMAccountException(VMMException):
       
    57     """Exception class for Account exceptions"""
       
    58     pass
       
    59 
       
    60 
       
    61 class VMMAliasException(VMMException):
       
    62     """Exception class for Alias exceptions"""
       
    63     pass
       
    64 
       
    65 
       
    66 class VMMEmailAddressException(VMMException):
       
    67     """Exception class for EmailAddress exceptions"""
       
    68     pass
       
    69 
       
    70 
       
    71 class VMMMailLocationException(VMMException):
       
    72     """Exception class for MailLocation exceptions"""
       
    73     pass
       
    74 
       
    75 
       
    76 class VMMRelocatedException(VMMException):
       
    77     """Exception class for Relocated exceptions"""
       
    78     pass
       
    79 
       
    80 
       
    81 class VMMTransportException(VMMException):
       
    82     """Exception class for Transport exceptions"""
       
    83     pass