summaryrefslogtreecommitdiff
path: root/devdocs/python~3.12/library%2Femail.errors.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/python~3.12/library%2Femail.errors.html
new repository
Diffstat (limited to 'devdocs/python~3.12/library%2Femail.errors.html')
-rw-r--r--devdocs/python~3.12/library%2Femail.errors.html39
1 files changed, 39 insertions, 0 deletions
diff --git a/devdocs/python~3.12/library%2Femail.errors.html b/devdocs/python~3.12/library%2Femail.errors.html
new file mode 100644
index 00000000..d9f65906
--- /dev/null
+++ b/devdocs/python~3.12/library%2Femail.errors.html
@@ -0,0 +1,39 @@
+ <span id="email-errors-exception-and-defect-classes"></span><h1>email.errors: Exception and Defect classes</h1> <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/email/errors.py">Lib/email/errors.py</a></p> <p>The following exception classes are defined in the <a class="reference internal" href="#module-email.errors" title="email.errors: The exception classes used by the email package."><code>email.errors</code></a> module:</p> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MessageError">
+<code>exception email.errors.MessageError</code> </dt> <dd>
+<p>This is the base class for all exceptions that the <a class="reference internal" href="email#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code>email</code></a> package can raise. It is derived from the standard <a class="reference internal" href="exceptions#Exception" title="Exception"><code>Exception</code></a> class and defines no additional methods.</p> </dd>
+</dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MessageParseError">
+<code>exception email.errors.MessageParseError</code> </dt> <dd>
+<p>This is the base class for exceptions raised by the <a class="reference internal" href="email.parser#email.parser.Parser" title="email.parser.Parser"><code>Parser</code></a> class. It is derived from <a class="reference internal" href="#email.errors.MessageError" title="email.errors.MessageError"><code>MessageError</code></a>. This class is also used internally by the parser used by <a class="reference internal" href="email.headerregistry#module-email.headerregistry" title="email.headerregistry: Automatic Parsing of headers based on the field name"><code>headerregistry</code></a>.</p> </dd>
+</dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.HeaderParseError">
+<code>exception email.errors.HeaderParseError</code> </dt> <dd>
+<p>Raised under some error conditions when parsing the <span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5322.html"><strong>RFC 5322</strong></a> headers of a message, this class is derived from <a class="reference internal" href="#email.errors.MessageParseError" title="email.errors.MessageParseError"><code>MessageParseError</code></a>. The <a class="reference internal" href="email.message#email.message.EmailMessage.set_boundary" title="email.message.EmailMessage.set_boundary"><code>set_boundary()</code></a> method will raise this error if the content type is unknown when the method is called. <a class="reference internal" href="email.header#email.header.Header" title="email.header.Header"><code>Header</code></a> may raise this error for certain base64 decoding errors, and when an attempt is made to create a header that appears to contain an embedded header (that is, there is what is supposed to be a continuation line that has no leading whitespace and looks like a header).</p> </dd>
+</dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.BoundaryError">
+<code>exception email.errors.BoundaryError</code> </dt> <dd>
+<p>Deprecated and no longer used.</p> </dd>
+</dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MultipartConversionError">
+<code>exception email.errors.MultipartConversionError</code> </dt> <dd>
+<p>Raised when a payload is added to a <a class="reference internal" href="email.compat32-message#email.message.Message" title="email.message.Message"><code>Message</code></a> object using <code>add_payload()</code>, but the payload is already a scalar and the message’s <em class="mailheader">Content-Type</em> main type is not either <em class="mimetype">multipart</em> or missing. <a class="reference internal" href="#email.errors.MultipartConversionError" title="email.errors.MultipartConversionError"><code>MultipartConversionError</code></a> multiply inherits from <a class="reference internal" href="#email.errors.MessageError" title="email.errors.MessageError"><code>MessageError</code></a> and the built-in <a class="reference internal" href="exceptions#TypeError" title="TypeError"><code>TypeError</code></a>.</p> <p>Since <code>Message.add_payload()</code> is deprecated, this exception is rarely raised in practice. However the exception may also be raised if the <a class="reference internal" href="email.compat32-message#email.message.Message.attach" title="email.message.Message.attach"><code>attach()</code></a> method is called on an instance of a class derived from <a class="reference internal" href="email.mime#email.mime.nonmultipart.MIMENonMultipart" title="email.mime.nonmultipart.MIMENonMultipart"><code>MIMENonMultipart</code></a> (e.g. <a class="reference internal" href="email.mime#email.mime.image.MIMEImage" title="email.mime.image.MIMEImage"><code>MIMEImage</code></a>).</p> </dd>
+</dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MessageDefect">
+<code>exception email.errors.MessageDefect</code> </dt> <dd>
+<p>This is the base class for all defects found when parsing email messages. It is derived from <a class="reference internal" href="exceptions#ValueError" title="ValueError"><code>ValueError</code></a>.</p> </dd>
+</dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.HeaderDefect">
+<code>exception email.errors.HeaderDefect</code> </dt> <dd>
+<p>This is the base class for all defects found when parsing email headers. It is derived from <a class="reference internal" href="#email.errors.MessageDefect" title="email.errors.MessageDefect"><code>MessageDefect</code></a>.</p> </dd>
+</dl> <p>Here is the list of the defects that the <a class="reference internal" href="email.parser#email.parser.FeedParser" title="email.parser.FeedParser"><code>FeedParser</code></a> can find while parsing messages. Note that the defects are added to the message where the problem was found, so for example, if a message nested inside a <em class="mimetype">multipart/alternative</em> had a malformed header, that nested message object would have a defect, but the containing messages would not.</p> <p>All defect classes are subclassed from <a class="reference internal" href="#email.errors.MessageDefect" title="email.errors.MessageDefect"><code>email.errors.MessageDefect</code></a>.</p> <ul> <li>
+<code>NoBoundaryInMultipartDefect</code> – A message claimed to be a multipart, but had no <em class="mimetype">boundary</em> parameter.</li> <li>
+<code>StartBoundaryNotFoundDefect</code> – The start boundary claimed in the <em class="mailheader">Content-Type</em> header was never found.</li> <li>
+<p><code>CloseBoundaryNotFoundDefect</code> – A start boundary was found, but no corresponding close boundary was ever found.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.3.</span></p> </div> </li> <li>
+<code>FirstHeaderLineIsContinuationDefect</code> – The message had a continuation line as its first header line.</li> <li>
+<code>MisplacedEnvelopeHeaderDefect</code> - A “Unix From” header was found in the middle of a header block.</li> <li>
+<p><code>MissingHeaderBodySeparatorDefect</code> - A line was found while parsing headers that had no leading white space but contained no ‘:’. Parsing continues assuming that the line represents the first line of the body.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.3.</span></p> </div> </li> <li>
+<p><code>MalformedHeaderDefect</code> – A header was found that was missing a colon, or was otherwise malformed.</p> <div class="deprecated"> <p><span class="versionmodified deprecated">Deprecated since version 3.3: </span>This defect has not been used for several Python versions.</p> </div> </li> <li>
+<code>MultipartInvariantViolationDefect</code> – A message claimed to be a <em class="mimetype">multipart</em>, but no subparts were found. Note that when a message has this defect, its <a class="reference internal" href="email.compat32-message#email.message.Message.is_multipart" title="email.message.Message.is_multipart"><code>is_multipart()</code></a> method may return <code>False</code> even though its content type claims to be <em class="mimetype">multipart</em>.</li> <li>
+<code>InvalidBase64PaddingDefect</code> – When decoding a block of base64 encoded bytes, the padding was not correct. Enough padding is added to perform the decode, but the resulting decoded bytes may be invalid.</li> <li>
+<code>InvalidBase64CharactersDefect</code> – When decoding a block of base64 encoded bytes, characters outside the base64 alphabet were encountered. The characters are ignored, but the resulting decoded bytes may be invalid.</li> <li>
+<code>InvalidBase64LengthDefect</code> – When decoding a block of base64 encoded bytes, the number of non-padding base64 characters was invalid (1 more than a multiple of 4). The encoded block was kept as-is.</li> <li>
+<code>InvalidDateDefect</code> – When decoding an invalid or unparsable date field. The original value is kept as-is.</li> </ul> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2001&ndash;2023 Python Software Foundation<br>Licensed under the PSF License.<br>
+ <a href="https://docs.python.org/3.12/library/email.errors.html" class="_attribution-link">https://docs.python.org/3.12/library/email.errors.html</a>
+ </p>
+</div>