kennethreitz/requests — pull request #767 by stefanp (2012-08-08 18:58:42+00:00)
Title: Wrap socket.error in ConnectionError (+ unit tests)

On connection refused, requests recently started throwing lower-level socket.error exceptions instead of ConnectionError, which does not match the API docs and breaks existing code. I reported this here: https://github.com/kennethreitz/requests/issues/748

I believe the following commit introduced this bug: https://github.com/kennethreitz/requests/commit/e02fb2eb6c2acfa67793a2c77a3c7bd47998a024

This pull request simply catches socket.error in Request.send, and re-raises ConnectionError

It also adds two (now passing) unit tests, based on existing ones that are commented out (I left them untouched).