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