VirtualMailManager/errors.py
changeset 571 a4aead244f75
parent 568 14abdd04ddf5
child 675 d24f094d1cb5
equal deleted inserted replaced
465:c0e1fb1b0145 571:a4aead244f75
       
     1 # -*- coding: UTF-8 -*-
       
     2 # Copyright (c) 2007 - 2012, Pascal Volk
       
     3 # See COPYING for distribution information.
       
     4 """
       
     5     VirtualMailManager.errors
       
     6     ~~~~~~~~~~~~~~~~~~~~~~~~~
       
     7 
       
     8     VMM's Exception classes
       
     9 """
       
    10 
       
    11 
       
    12 class VMMError(Exception):
       
    13     """Exception base class for VirtualMailManager exceptions"""
       
    14 
       
    15     def __init__(self, msg, code):
       
    16         Exception.__init__(self, msg)
       
    17         self.msg = msg
       
    18         self.code = int(code)
       
    19 
       
    20     def __repr__(self):
       
    21         return '%s(%r, %r)' % (self.__class__.__name__, self.msg, self.code)
       
    22 
       
    23 
       
    24 class ConfigError(VMMError):
       
    25     """Exception class for configuration exceptions"""
       
    26     pass
       
    27 
       
    28 
       
    29 class PermissionError(VMMError):
       
    30     """Exception class for permissions exceptions"""
       
    31     pass
       
    32 
       
    33 
       
    34 class NotRootError(VMMError):
       
    35     """Exception class for non-root exceptions"""
       
    36     pass
       
    37 
       
    38 
       
    39 class DomainError(VMMError):
       
    40     """Exception class for Domain exceptions"""
       
    41     pass
       
    42 
       
    43 
       
    44 class AliasDomainError(VMMError):
       
    45     """Exception class for AliasDomain exceptions"""
       
    46     pass
       
    47 
       
    48 
       
    49 class AccountError(VMMError):
       
    50     """Exception class for Account exceptions"""
       
    51     pass
       
    52 
       
    53 
       
    54 class AliasError(VMMError):
       
    55     """Exception class for Alias exceptions"""
       
    56     pass
       
    57 
       
    58 
       
    59 class EmailAddressError(VMMError):
       
    60     """Exception class for EmailAddress exceptions"""
       
    61     pass
       
    62 
       
    63 
       
    64 class MailLocationError(VMMError):
       
    65     """Exception class for MailLocation exceptions"""
       
    66     pass
       
    67 
       
    68 
       
    69 class RelocatedError(VMMError):
       
    70     """Exception class for Relocated exceptions"""
       
    71     pass