[issue24788] HTTPException is derived from Exception instead of IOError

Pastafarianist report at bugs.python.org
Wed Aug 26 01:20:13 CEST 2015


Pastafarianist added the comment:

I agree that the five exception types you mentioned (UnknownProtocol, UnknownTransferEncoding, IncompleteRead, BadStatusLine, LineTooLong) should be derived from IOError. EOFError is probably not a good choice here. It's not something I would expect to see in networking code. ValueError may be better, but I don't know enough about the library to tell whether it is common to use ValueError in similar contexts.

However, ImproperConnectionState (specifically, CannotSendRequest) may be not a programmer error, and, thus, it might be better to have it derived from IOError. See https://hg.python.org/cpython/file/3.5/Lib/http/client.py#l933. Depending on your point of view, you may consider this to be a programmer error or not.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24788>
_______________________________________


More information about the Python-bugs-list mailing list