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