Martin Panter added the comment:

Did you have any specific exceptions in mind, or specific subclasses of 
IOError? In 3.5 we now have the RemoteDisconnected exception, which derives 
ConnectionResetError. Some of the other exceptions are only local programmer 
errors. Currently documented exceptions:

Exception:
  http.client.HTTPException:
  * NotConnected
  * InvalidURL
  * UnknownProtocol
  * UnknownTransferEncoding
  * UnimplementedFileMode
  * IncompleteRead
  * ImproperConnectionState:
    + CannotSendRequest
    + CannotSendHeader
    + ResponseNotReady
  * BadStatusLine
    + RemoteDisconnected
  * LineTooLong

NotConnected is a programmer error, and it is only raised if the undocumented 
and untested “auto_open” flag is cleared.

InvalidURL is triggered by the input URL, not the network or remote server.

UnknownTransferEncoding was once triggered by the remote response, but is no 
longer invoked; see Issue 600488. Maybe it should be deprecated?

UnimplementedFileMode looks like it was once either an internal consistency 
error, or a programmer error, raised by passing the wrong mode to 
FakeSocket.makefile(). Unused since r57680; probably should also be deprecated.

The ImproperConnectionState hierarchy exceptions are also programmer errors, 
raised when the wrong method is called according to the local object state.

I would perhaps support UnknownProtocol, IncompleteRead, BadStatusLine, 
LineTooLong (and maybe UnknownTransferEncoding) being derived from some more 
specific exception. Maybe ValueError would be more appropriate for protocol 
errors, EOFError for IncompleteRead. I’m not sure.

OSError is specifically designed for errors related to C’s “errno”, and none of 
these errors are related to “errno”. Though I acknowledge there are other 
subclasses that ignore this fact, such as URLError.

----------
nosy: +vadmium

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24788>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to