source: python/trunk/Lib/email/errors.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1# Copyright (C) 2001-2006 Python Software Foundation
2# Author: Barry Warsaw
3# Contact: email-sig@python.org
4
5"""email package exception classes."""
6
7
8
9
10class MessageError(Exception):
11 """Base class for errors in the email package."""
12
13
14class MessageParseError(MessageError):
15 """Base class for message parsing errors."""
16
17
18class HeaderParseError(MessageParseError):
19 """Error while parsing headers."""
20
21
22class BoundaryError(MessageParseError):
23 """Couldn't find terminating boundary."""
24
25
26class MultipartConversionError(MessageError, TypeError):
27 """Conversion to a multipart is prohibited."""
28
29
30class CharsetError(MessageError):
31 """An illegal charset was given."""
32
33
34
35
36# These are parsing defects which the parser was able to work around.
37class MessageDefect:
38 """Base class for a message defect."""
39
40 def __init__(self, line=None):
41 self.line = line
42
43class NoBoundaryInMultipartDefect(MessageDefect):
44 """A message claimed to be a multipart but had no boundary parameter."""
45
46class StartBoundaryNotFoundDefect(MessageDefect):
47 """The claimed start boundary was never found."""
48
49class FirstHeaderLineIsContinuationDefect(MessageDefect):
50 """A message had a continuation line as its first header line."""
51
52class MisplacedEnvelopeHeaderDefect(MessageDefect):
53 """A 'Unix-from' header was found in the middle of a header block."""
54
55class MalformedHeaderDefect(MessageDefect):
56 """Found a header that was missing a colon, or was otherwise malformed."""
57
58class MultipartInvariantViolationDefect(MessageDefect):
59 """A message claimed to be a multipart but no subparts were found."""
Note: See TracBrowser for help on using the repository browser.