Movatterモバイル変換


[0]ホーム

URL:


Up one LevelPython Library ReferenceContentsModule IndexIndex

7.1.8 Exception and Defect classes

The following exception classes are defined in theemail.errors module:

exception MessageError()
This is the base class for all exceptions that theemailpackage can raise. It is derived from the standardException class and defines no additional methods.

exception MessageParseError()
This is the base class for exceptions thrown by theParserclass. It is derived fromMessageError.

exception HeaderParseError()
Raised under some error conditions when parsing theRFC 2822 headers ofa message, this class is derived fromMessageParseError.It can be raised from theParser.parse() orParser.parsestr() methods.

Situations where it can be raised include finding an envelopeheader after the firstRFC 2822 header of the message, finding acontinuation line before the firstRFC 2822 header is found, or findinga line in the headers which is neither a header or a continuationline.

exception BoundaryError()
Raised under some error conditions when parsing theRFC 2822 headers ofa message, this class is derived fromMessageParseError.It can be raised from theParser.parse() orParser.parsestr() methods.

Situations where it can be raised include not being able to find thestarting or terminating boundary in amultipart/* messagewhen strict parsing is used.

exception MultipartConversionError()
Raised when a payload is added to aMessage object usingadd_payload(), but the payload is already a scalar and themessage'sContent-Type: main type is not eithermultipart or missing.MultipartConversionErrormultiply inherits fromMessageError and the built-inTypeError.

SinceMessage.add_payload() is deprecated, this exception israrely raised in practice. However the exception may also be raisedif theattach() method is called on an instance of a classderived fromMIMENonMultipart (e.g.MIMEImage).

Here's the list of the defects that theFeedParser can find whileparsing messages. Note that the defects are added to the message where theproblem was found, so for example, if a message nested inside amultipart/alternative had a malformed header, that nested messageobject would have a defect, but the containing messages would not.

All defect classes are subclassed fromemail.errors.MessageDefect, butthis class isnot an exception!

New in version 2.4:All the defect classes were added.


Up one LevelPython Library ReferenceContentsModule IndexIndex

Release 2.5.2, documentation updated on 21st February, 2008.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2025 Movatter.jp