Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / module-email.Errors.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-email.Utils.html" />
13<link rel="prev" href="module-email.Encoders.html" />
14<link rel="parent" href="module-email.html" />
15<link rel="next" href="module-email.Utils.html" />
16<meta name='aesop' content='information' />
17<title>12.2.8 Exception and Defect classes</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="12.2.7 Encoders"
25 href="module-email.Encoders.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="12.2 email "
28 href="module-email.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="12.2.9 Miscellaneous utilities"
31 href="module-email.Utils.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="module-email.Encoders.html">12.2.7 Encoders</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-email.html">12.2 email </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-email.Utils.html">12.2.9 Miscellaneous utilities</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION0014280000000000000000">
5612.2.8 Exception and Defect classes</A>
57</H2>
58<A NAME="module-email.Errors"></A>
59
60<P>
61The following exception classes are defined in the
62<tt class="module">email.Errors</tt> module:
63
64<P>
65<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
66 <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-3936' xml:id='l2h-3936' class="exception">MessageError</tt></b>(</nobr></td>
67 <td><var></var>)</td></tr></table></dt>
68<dd>
69This is the base class for all exceptions that the <tt class="module">email</tt>
70package can raise. It is derived from the standard
71<tt class="exception">Exception</tt> class and defines no additional methods.
72</dl>
73
74<P>
75<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
76 <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-3937' xml:id='l2h-3937' class="exception">MessageParseError</tt></b>(</nobr></td>
77 <td><var></var>)</td></tr></table></dt>
78<dd>
79This is the base class for exceptions thrown by the <tt class="class">Parser</tt>
80class. It is derived from <tt class="exception">MessageError</tt>.
81</dl>
82
83<P>
84<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
85 <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-3938' xml:id='l2h-3938' class="exception">HeaderParseError</tt></b>(</nobr></td>
86 <td><var></var>)</td></tr></table></dt>
87<dd>
88Raised under some error conditions when parsing the <a class="rfc" id='rfcref-90944' xml:id='rfcref-90944'
89href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a> headers of
90a message, this class is derived from <tt class="exception">MessageParseError</tt>.
91It can be raised from the <tt class="method">Parser.parse()</tt> or
92<tt class="method">Parser.parsestr()</tt> methods.
93
94<P>
95Situations where it can be raised include finding an envelope
96header after the first <a class="rfc" id='rfcref-90946' xml:id='rfcref-90946'
97href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a> header of the message, finding a
98continuation line before the first <a class="rfc" id='rfcref-90948' xml:id='rfcref-90948'
99href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a> header is found, or finding
100a line in the headers which is neither a header or a continuation
101line.
102</dl>
103
104<P>
105<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
106 <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-3939' xml:id='l2h-3939' class="exception">BoundaryError</tt></b>(</nobr></td>
107 <td><var></var>)</td></tr></table></dt>
108<dd>
109Raised under some error conditions when parsing the <a class="rfc" id='rfcref-90950' xml:id='rfcref-90950'
110href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a> headers of
111a message, this class is derived from <tt class="exception">MessageParseError</tt>.
112It can be raised from the <tt class="method">Parser.parse()</tt> or
113<tt class="method">Parser.parsestr()</tt> methods.
114
115<P>
116Situations where it can be raised include not being able to find the
117starting or terminating boundary in a <span class="mimetype">multipart/*</span> message
118when strict parsing is used.
119</dl>
120
121<P>
122<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
123 <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-3940' xml:id='l2h-3940' class="exception">MultipartConversionError</tt></b>(</nobr></td>
124 <td><var></var>)</td></tr></table></dt>
125<dd>
126Raised when a payload is added to a <tt class="class">Message</tt> object using
127<tt class="method">add_payload()</tt>, but the payload is already a scalar and the
128message's <span class="mailheader">Content-Type:</span> main type is not either
129<span class="mimetype">multipart</span> or missing. <tt class="exception">MultipartConversionError</tt>
130multiply inherits from <tt class="exception">MessageError</tt> and the built-in
131<tt class="exception">TypeError</tt>.
132
133<P>
134Since <tt class="method">Message.add_payload()</tt> is deprecated, this exception is
135rarely raised in practice. However the exception may also be raised
136if the <tt class="method">attach()</tt> method is called on an instance of a class
137derived from <tt class="class">MIMENonMultipart</tt> (e.g. <tt class="class">MIMEImage</tt>).
138</dl>
139
140<P>
141Here's the list of the defects that the <tt class="class">FeedParser</tt> can find while
142parsing messages. Note that the defects are added to the message where the
143problem was found, so for example, if a message nested inside a
144<span class="mimetype">multipart/alternative</span> had a malformed header, that nested message
145object would have a defect, but the containing messages would not.
146
147<P>
148All defect classes are subclassed from <tt class="class">email.Errors.MessageDefect</tt>, but
149this class is <em>not</em> an exception!
150
151<P>
152
153<span class="versionnote">New in version 2.4:
154All the defect classes were added.</span>
155
156<P>
157
158<UL>
159<LI><tt class="class">NoBoundaryInMultipartDefect</tt> - A message claimed to be a
160 multipart, but had no <span class="mimetype">boundary</span> parameter.
161
162<P>
163</LI>
164<LI><tt class="class">StartBoundaryNotFoundDefect</tt> - The start boundary claimed in the
165 <span class="mailheader">Content-Type:</span> header was never found.
166
167<P>
168</LI>
169<LI><tt class="class">FirstHeaderLineIsContinuationDefect</tt> - The message had a
170 continuation line as its first header line.
171
172<P>
173</LI>
174<LI><tt class="class">MisplacedEnvelopeHeaderDefect</tt> - A ``Unix From'' header was found
175 in the middle of a header block.
176
177<P>
178</LI>
179<LI><tt class="class">MalformedHeaderDefect</tt> - A header was found that was missing a
180 colon, or was otherwise malformed.
181
182<P>
183</LI>
184<LI><tt class="class">MultipartInvariantViolationDefect</tt> - A message claimed to be a
185 <span class="mimetype">multipart</span>, but no subparts were found. Note that when a
186 message has this defect, its <tt class="method">is_multipart()</tt> method may return
187 false even though its content type claims to be <span class="mimetype">multipart</span>.
188</LI>
189</UL>
190
191<P>
192
193<DIV CLASS="navigation">
194<div class='online-navigation'>
195<p></p><hr />
196<table align="center" width="100%" cellpadding="0" cellspacing="2">
197<tr>
198<td class='online-navigation'><a rel="prev" title="12.2.7 Encoders"
199 href="module-email.Encoders.html"><img src='../icons/previous.png'
200 border='0' height='32' alt='Previous Page' width='32' /></A></td>
201<td class='online-navigation'><a rel="parent" title="12.2 email "
202 href="module-email.html"><img src='../icons/up.png'
203 border='0' height='32' alt='Up One Level' width='32' /></A></td>
204<td class='online-navigation'><a rel="next" title="12.2.9 Miscellaneous utilities"
205 href="module-email.Utils.html"><img src='../icons/next.png'
206 border='0' height='32' alt='Next Page' width='32' /></A></td>
207<td align="center" width="100%">Python Library Reference</td>
208<td class='online-navigation'><a rel="contents" title="Table of Contents"
209 href="contents.html"><img src='../icons/contents.png'
210 border='0' height='32' alt='Contents' width='32' /></A></td>
211<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
212 border='0' height='32' alt='Module Index' width='32' /></a></td>
213<td class='online-navigation'><a rel="index" title="Index"
214 href="genindex.html"><img src='../icons/index.png'
215 border='0' height='32' alt='Index' width='32' /></A></td>
216</tr></table>
217<div class='online-navigation'>
218<b class="navlabel">Previous:</b>
219<a class="sectref" rel="prev" href="module-email.Encoders.html">12.2.7 Encoders</A>
220<b class="navlabel">Up:</b>
221<a class="sectref" rel="parent" href="module-email.html">12.2 email </A>
222<b class="navlabel">Next:</b>
223<a class="sectref" rel="next" href="module-email.Utils.html">12.2.9 Miscellaneous utilities</A>
224</div>
225</div>
226<hr />
227<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
228</DIV>
229<!--End of Navigation Panel-->
230<ADDRESS>
231See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
232</ADDRESS>
233</BODY>
234</HTML>