Make batch errors align with normal errors.
Fixes issue #169.
Reviewed in http://codereview.appspot.com/6444046/.
diff --git a/apiclient/errors.py b/apiclient/errors.py
index b6ee9a5..b58d97f 100644
--- a/apiclient/errors.py
+++ b/apiclient/errors.py
@@ -54,7 +54,7 @@
def __repr__(self):
if self.uri:
return '<HttpError %s when requesting %s returned "%s">' % (
- self.resp.status, self.uri, self._get_reason())
+ self.resp.status, self.uri, self._get_reason().strip())
else:
return '<HttpError %s "%s">' % (self.resp.status, self._get_reason())
diff --git a/apiclient/http.py b/apiclient/http.py
index 1dfe36c..96d7a14 100644
--- a/apiclient/http.py
+++ b/apiclient/http.py
@@ -649,7 +649,6 @@
resp, content = http.request(self.uri, self.method,
body=self.body,
headers=self.headers)
-
if resp.status >= 300:
raise HttpError(resp, content, self.uri)
return self.postproc(resp, content)
@@ -1185,6 +1184,8 @@
response = None
exception = None
try:
+ if resp.status >= 300:
+ raise HttpError(resp, content, request.uri)
response = request.postproc(resp, content)
except HttpError, e:
exception = e