Skip to content

xtr_mime.exception

The errors this package raises, every one a :class:MimeError.

InvalidArgumentError

Bases: MimeError, ValueError

A value handed to this library cannot be used: an unknown charset, an unreadable path.

Also a :class:ValueError, so code that already guards against a bad value catches it without knowing this library exists.

LogicError

Bases: MimeError, RuntimeError

This library was used in a way that cannot work, whatever the values involved.

A message with no body, a part asked for something only another kind of part has: each is a mistake in the calling code, so trying again changes nothing.

MimeError

Bases: Exception

A message could not be built or rendered — catch this to catch them all.

MimeRuntimeError

Bases: MimeError, RuntimeError

Something outside the calling code failed: a file that vanished, a key that would not load.

The values handed in were fine and so is the code; the world did not cooperate.

RfcComplianceError

Bases: InvalidArgumentError

A value breaks the rules of the mail standards, so no server would accept it.

An address that is not one, a domain that cannot be written in ASCII, a header parameter name that is not a token. A kind of :class:InvalidArgumentError, kept apart so a caller validating user input can tell "not an email address" from any other bad value.