Merged revisions 83951 via svnmerge from
[python/dscho.git] / Lib / email / errors.py
blobd52a624601f09216ba49f727c6b3fd1853b9ef68
1 # Copyright (C) 2001-2006 Python Software Foundation
2 # Author: Barry Warsaw
3 # Contact: email-sig@python.org
5 """email package exception classes."""
8 \f
9 class MessageError(Exception):
10 """Base class for errors in the email package."""
13 class MessageParseError(MessageError):
14 """Base class for message parsing errors."""
17 class HeaderParseError(MessageParseError):
18 """Error while parsing headers."""
21 class BoundaryError(MessageParseError):
22 """Couldn't find terminating boundary."""
25 class MultipartConversionError(MessageError, TypeError):
26 """Conversion to a multipart is prohibited."""
29 class CharsetError(MessageError):
30 """An illegal charset was given."""
34 # These are parsing defects which the parser was able to work around.
35 class MessageDefect:
36 """Base class for a message defect."""
38 def __init__(self, line=None):
39 self.line = line
41 class NoBoundaryInMultipartDefect(MessageDefect):
42 """A message claimed to be a multipart but had no boundary parameter."""
44 class StartBoundaryNotFoundDefect(MessageDefect):
45 """The claimed start boundary was never found."""
47 class FirstHeaderLineIsContinuationDefect(MessageDefect):
48 """A message had a continuation line as its first header line."""
50 class MisplacedEnvelopeHeaderDefect(MessageDefect):
51 """A 'Unix-from' header was found in the middle of a header block."""
53 class MalformedHeaderDefect(MessageDefect):
54 """Found a header that was missing a colon, or was otherwise malformed."""
56 class MultipartInvariantViolationDefect(MessageDefect):
57 """A message claimed to be a multipart but no subparts were found."""