VirtualMailManager/errors.py
author Pascal Volk <neverseen@users.sourceforge.net>
Mon, 26 Jul 2010 01:18:49 +0000
branchv0.6.x
changeset 312 6f39a1e56f4a
parent 216 0c8c053b451c
child 320 011066435e6f
permissions -rw-r--r--
VMM/cli: w_err() call os.sys.exit only if code != 0. read_pass() write errors to stderr. And a few other small fixes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
# -*- coding: UTF-8 -*-
162
0ac9ef587769 Updated copyright notices to include the year 2010.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 138
diff changeset
     2
# Copyright (c) 2007 - 2010, Pascal Volk
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
# See COPYING for distribution information.
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     5
"""
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
     6
    VirtualMailManager.errors
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     7
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     8
    VMM's Exception classes
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     9
"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    10
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    12
class VMMError(Exception):
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    13
    """Exception base class for VirtualMailManager exceptions"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    14
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    15
    def __init__(self, msg, code):
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
        Exception.__init__(self, msg)
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    17
        self.msg = msg
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    18
        self.code = int(code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    20
    def __repr__(self):
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    21
        return '%s(%r, %r)' % (self.__class__.__name__, self.msg, self.code)
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    22
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    23
class ConfigError(VMMError):
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    24
    """Exception class for configuration exceptions"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    25
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    26
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    28
class PermissionError(VMMError):
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    29
    """Exception class for permissions exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    30
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    31
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    32
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    33
class NotRootError(VMMError):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    34
    """Exception class for non-root exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    35
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    36
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    37
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    38
class DomainError(VMMError):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    39
    """Exception class for Domain exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    40
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    41
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    42
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    43
class AliasDomainError(VMMError):
55
15c873f94ba6 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 48
diff changeset
    44
    """Exception class for AliasDomain exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    45
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    46
47
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    47
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    48
class AccountError(VMMError):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    49
    """Exception class for Account exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    50
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    51
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    52
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    53
class AliasError(VMMError):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    54
    """Exception class for Alias exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    55
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    56
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    57
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    58
class EmailAddressError(VMMError):
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    59
    """Exception class for EmailAddress exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    60
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    61
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    62
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    63
class MailLocationError(VMMError):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    64
    """Exception class for MailLocation exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    65
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    66
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    67
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    68
class RelocatedError(VMMError):
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    69
    """Exception class for Relocated exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    70
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    71
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    72
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    73
class TransportError(VMMError):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    74
    """Exception class for Transport exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    75
    pass