Enhanced HttpError to now include the original request URI if possible.
diff --git a/apiclient/discovery.py b/apiclient/discovery.py
index 0c4c854..cc31967 100644
--- a/apiclient/discovery.py
+++ b/apiclient/discovery.py
@@ -39,6 +39,7 @@
from model import JsonModel
from errors import UnknownLinkType
from errors import HttpError
+from errors import InvalidJsonError
URITEMPLATE = re.compile('{[^}]*}')
VARNAME = re.compile('[a-zA-Z0-9_-]+')
@@ -108,10 +109,12 @@
requested_url = uritemplate.expand(discoveryServiceUrl, params)
logging.info('URL being requested: %s' % requested_url)
resp, content = http.request(requested_url)
+ if resp.status > 400:
+ raise HttpError(resp, content, requested_url)
try:
service = simplejson.loads(content)
except ValueError, e:
- raise HttpError(resp, content)
+ raise InvalidJsonError()
fn = os.path.join(os.path.dirname(__file__), 'contrib',
serviceName, 'future.json')