File: exceptions.py

package info (click to toggle)
getmail6 6.19.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,124 kB
  • sloc: python: 6,634; sh: 897; makefile: 73
file content (80 lines) | stat: -rwxr-xr-x 2,493 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# -*- coding: utf-8 -*-
# docs/COPYING 2a + DRY: https://github.com/getmail6/getmail6
# Please refer to the git history regarding who changed what and when in this file.

'''Exceptions raised by getmail.
'''

__all__ = [
    'getmailConfigurationError',
    'getmailCredentialError',
    'getmailDeliveryError',
    'getmailDnsLookupError',
    'getmailDnsServerFailure',
    'getmailError',
    'getmailFilterError',
    'getmailLoginRefusedError',
    'getmailMailboxSelectError',
    'getmailOperationError',
    'getmailRetrievalError',
]

# Base class for all getmail exceptions
class getmailError(Exception):
    '''Base class for all getmail exceptions.'''
    pass

# Specific exception classes
class getmailConfigurationError(getmailError):
    '''Exception raised when a user configuration error is detected.'''
    pass

class getmailOperationError(getmailError):
    '''Exception raised when a runtime error is detected.'''
    pass

class getmailRetrievalError(getmailOperationError):
    '''Exception raised when a server (cough MSExchange cough) fails to
    hand over a message it claims to have.'''
    pass

class getmailFilterError(getmailOperationError):
    '''Exception raised when problems occur during message filtering.
    Subclass of getmailOperationError.
    '''
    pass

class getmailDeliveryError(getmailOperationError):
    '''Exception raised when problems occur during message delivery.
    Subclass of getmailOperationError.
    '''
    pass

class getmailDnsError(getmailOperationError):
    '''Base class for errors looking up hosts in DNS to connect to.'''
    pass

class getmailDnsLookupError(getmailDnsError):
    '''No such DNS name, or name found but no address records for it.'''
    pass

class getmailDnsServerFailure(getmailDnsError):
    '''DNS server failed when trying to look up name.'''
    pass

class getmailCredentialError(getmailOperationError):
    '''Error raised when server says "bad password", "no such user", etc
    (when that is possible to detect).'''
    pass

class getmailLoginRefusedError(getmailOperationError):
    '''Error raised when the server is just refusing logins due to reasons
    other than credential problems (when that is possible to detect):  server
    too busy, service shutting down, etc.'''
    pass

class getmailMailboxSelectError(getmailOperationError):
    '''Error raised when the server responds NO to an (IMAP) select mailbox
    command -- no such mailbox, no permissions, etc.
    '''
    pass