VirtualMailManager/Exceptions.py
author Pascal Volk <neverseen@users.sourceforge.net>
Sun, 09 Aug 2009 00:37:56 +0000
changeset 102 485d3f7d6981
parent 76 14c0a092d7d2
child 138 617f27715b01
permissions -rw-r--r--
Removed svn keywords, more POSIX compliant shell scripts Removed the subversion keywords $Date$, $Id$ and $Rev$ from all files. Added centralized versions information from VirtualMailManager.constants.VERSION to many files. install.sh and upgrade.sh do now strict POSIX compliant string comparison in expressions. Fixed a type in upgrade.sh. Updated copyright information

# -*- coding: UTF-8 -*-
# Copyright (c) 2007 - 2009, VEB IT
# See COPYING for distribution information.

"""Exception classes for Virtual Mail Manager"""

from constants.VERSION import *

class VMMException(Exception):
    """Exception class for VirtualMailManager exceptions"""
    def __init__(self, msg, code):
        Exception.__init__(self, msg)
        self._code = int(code)
        ### for older python versions, like py 2.4.4 on OpenBSD 4.2
        if not hasattr(self, 'message'):
            self.message = msg

    def msg(self):
        """Returns the exception message."""
        return self.message

    def code(self):
        """Returns the numeric exception error code."""
        return self._code

class VMMConfigException(VMMException):
    """Exception class for Configurtion exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMPermException(VMMException):
    """Exception class for permissions exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMNotRootException(VMMException):
    """Exception class for non-root exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMDomainException(VMMException):
    """Exception class for Domain exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMAliasDomainException(VMMException):
    """Exception class for AliasDomain exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMAccountException(VMMException):
    """Exception class for Account exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMAliasException(VMMException):
    """Exception class for Alias exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMEmailAddressException(VMMException):
    """Exception class for EmailAddress exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMMailLocationException(VMMException):
    """Exception class for MailLocation exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMRelocatedException(VMMException):
    """Exception class for Relocated exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)

class VMMTransportException(VMMException):
    """Exception class for Transport exceptions"""
    def __init__(self, msg, code):
        VMMException.__init__(self, msg, code)