Skip to content

xtr_http_message.exception

Everything this package raises, under one base class.

The contract names two builtins — :class:ValueError for an argument that cannot be what it is being used as, :class:RuntimeError for an operation that cannot be carried out now — so each error here derives from the builtin the contract named and from :class:~xtr_http_message.exception.http_message_error.HttpMessageError. A caller written against the interfaces catches the builtin; one that chose this implementation can catch the base class instead and get only its failures.

HttpMessageError

Bases: Exception

Something went wrong building or using a message, a stream or a URI.

Nothing raises this class itself; it exists so that an application can catch everything this package raises with one except clause, whichever of the four concrete errors reached it.

InvalidArgumentError

Bases: HttpMessageError, ValueError

An argument's value rules it out: a malformed header name, an out-of-range port.

It derives from :class:ValueError as well as from :class:~xtr_http_message.exception.http_message_error.HttpMessageError because that is what the contract promises a caller: code written against the interfaces catches the builtin and never names this package.

StreamError

Bases: HttpMessageError, RuntimeError

A stream operation cannot be carried out: detached, not seekable, not readable.

It derives from :class:RuntimeError as well as from :class:~xtr_http_message.exception.http_message_error.HttpMessageError because that is what the contract promises a caller: code written against the interfaces catches the builtin and never names this package.

UploadedFileError

Bases: HttpMessageError, RuntimeError

An uploaded file is unusable: the upload failed, or the file is already moved.

It derives from :class:RuntimeError as well as from :class:~xtr_http_message.exception.http_message_error.HttpMessageError because that is what the contract promises a caller: code written against the interfaces catches the builtin and never names this package.