VirtualMailManager/errors.py
author Pascal Volk <neverseen@users.sourceforge.net>
Fri, 26 Feb 2010 02:35:25 +0000
branchv0.6.x
changeset 216 0c8c053b451c
parent 214 VirtualMailManager/Exceptions.py@84e6e898e6c5
child 320 011066435e6f
permissions -rw-r--r--
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors. Renamed VMM*Exception classes to *Error. No longer add the attribute 'message' to VMMError if it doesn't exist, like in Python 2.4. It has been deprecated as of Python 2.6. Also removed the methods code() and msg(), the values are now accessible via the attributes 'code' and 'msg'.

# -*- coding: UTF-8 -*-
# Copyright (c) 2007 - 2010, Pascal Volk
# See COPYING for distribution information.

"""
    VirtualMailManager.errors

    VMM's Exception classes
"""


class VMMError(Exception):
    """Exception base class for VirtualMailManager exceptions"""

    def __init__(self, msg, code):
        Exception.__init__(self, msg)
        self.msg = msg
        self.code = int(code)

    def __repr__(self):
        return '%s(%r, %r)' % (self.__class__.__name__, self.msg, self.code)

class ConfigError(VMMError):
    """Exception class for configuration exceptions"""
    pass


class PermissionError(VMMError):
    """Exception class for permissions exceptions"""
    pass


class NotRootError(VMMError):
    """Exception class for non-root exceptions"""
    pass


class DomainError(VMMError):
    """Exception class for Domain exceptions"""
    pass


class AliasDomainError(VMMError):
    """Exception class for AliasDomain exceptions"""
    pass


class AccountError(VMMError):
    """Exception class for Account exceptions"""
    pass


class AliasError(VMMError):
    """Exception class for Alias exceptions"""
    pass


class EmailAddressError(VMMError):
    """Exception class for EmailAddress exceptions"""
    pass


class MailLocationError(VMMError):
    """Exception class for MailLocation exceptions"""
    pass


class RelocatedError(VMMError):
    """Exception class for Relocated exceptions"""
    pass


class TransportError(VMMError):
    """Exception class for Transport exceptions"""
    pass