This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Pastafarianist, martin.panter
Date 2015-08-04.23:51:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438732290.47.0.306669685886.issue24788@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-08-04 23:51:30martin.pantersetrecipients: + martin.panter, Pastafarianist
2015-08-04 23:51:30martin.pantersetmessageid: <1438732290.47.0.306669685886.issue24788@psf.upfronthosting.co.za>
2015-08-04 23:51:30martin.panterlinkissue24788 messages
2015-08-04 23:51:30martin.pantercreate