[Patches] httplib.HTTP.connect raises wrong exception

Jeremy Hylton jeremy@cnri.reston.va.us
Tue, 28 Mar 2000 15:17:11 -0500 (EST)


>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

  GvR> If it's a documentation issue, so fix the documentation.

Will work on it (unless Skip beats me to it).

  GvR> Although it is apparently not obvious, the HTTP class raises
  GvR> socket.error for lots of reasons -- invalid arguments being
  GvR> only a subclass.  This is in its nature, because all it does is
  GvR> make socket calls to implement the HTTP protocol.

  GvR> For this reason the one argument validity check that is done
  GvR> explicitly in the HTTP code is also made to raise socket.error.

That makes sense.

  GvR> Adding httplib.error = socket.error seems like splitting hairs,
  GvR> and seems to suggest a future migration path that I don't like
  GvR> (it suggests that in the future httplib.error might *not* be
  GvR> socket.error, and that it's wrong to catch socket.error when
  GvR> using httplib).

I don't agree.  It's merely a convenience for programmers; you can
catch httplib.error or import.error.  I don't feel strongly about this
issue, but I think the change is reasonable.

Jeremy