Add ResponseError exception class

This class is for erroneous states that occur after a response has been
downloaded from the server. Examples include a server that is raising many 500
server errors (with a Retry object coded to forbid this) or a redirect cycle
that exceeds the specified redirect limit.

In addition, ensures that all objects passed as the `reason` parameter to
MaxRetryError are Exception objects.
see #484.


--
Kevin Burke
phone: 925.271.7005 | twentymilliseconds.com

On Sat, Oct 4, 2014 at 6:05 AM, Ian Cordasco <notifications@github.com>
wrote:

> In test/test_retry.py:
>
> > @@ -172,7 +173,10 @@ def test_error_message(self):
> >              raise AssertionError("Should have raised a MaxRetryError")
> >          except MaxRetryError as e:
> >              assert 'Caused by redirect' not in str(e)
> > -            self.assertEqual(str(e.reason), 'received erroneous response too many times')
> > +            self.assertTrue(isinstance(e.reason, ResponseError),
> > +                            "%s should be a ResponseError" % e.reason)
> > +            self.assertEqual(str(e.reason),
> > +                             'received erroneous response too many times')
>
> I know this PR is already merged, but I wonder if we should reword this
> for the developers who speak English as a second language. I'm of the
> opinion that making their lives easier makes using urllib3 a better
> experience. They don't have to struggle with words like erroneous.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/shazow/urllib3/pull/481/files#r18429106>.
>