VirtualMailManager/errors.py
author martin f. krafft <madduck@madduck.net>
Sun, 15 Apr 2012 17:51:00 +0200
branchv0.6.x
changeset 550 867d950ce7b7
parent 449 6826acb9b0a7
child 568 14abdd04ddf5
permissions -rw-r--r--
Fix transport_maps function for non-existent domains The postfix_transport_maps function had a bug causing 2012-04-15 17:40:22 CEST LOG: statement: SELECT transport FROM postfix_transport_map('logcheck', 'domine.madduck.net'); 2012-04-15 17:40:22 CEST ERROR: query returned no rows when the domain was not in the database. This would make did be NULL and make the query fail. This patch moves the tid query until after a check for did. If the latter is NULL, the function RETURNs (rather than fails).

# -*- coding: UTF-8 -*-
# Copyright (c) 2007 - 2011, 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