Merge pull request #734 from doismellburning/verbose_http_errors

Include response.reason in raised HTTPErrors
This commit is contained in:
Kenneth Reitz
2012-07-24 06:46:34 -07:00
+3 -3
View File
@@ -821,16 +821,16 @@ class Response(object):
raise self.error
if (self.status_code >= 300) and (self.status_code < 400) and not allow_redirects:
http_error = HTTPError('%s Redirection' % self.status_code)
http_error = HTTPError('%s Redirection: %s' % (self.status_code, self.reason))
http_error.response = self
raise http_error
elif (self.status_code >= 400) and (self.status_code < 500):
http_error = HTTPError('%s Client Error' % self.status_code)
http_error = HTTPError('%s Client Error: %s' % (self.status_code, self.reason))
http_error.response = self
raise http_error
elif (self.status_code >= 500) and (self.status_code < 600):
http_error = HTTPError('%s Server Error' % self.status_code)
http_error = HTTPError('%s Server Error: %s' % (self.status_code, self.reason))
http_error.response = self
raise http_error