Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gcloud/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ def api_request(self, method, path, query_params=None,
target_object=_target_object)

if not 200 <= response.status < 300:
raise make_exception(response, content)
raise make_exception(response, content,
request_string=method+' '+url)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


string_or_bytes = (six.binary_type, six.text_type)
if content and expect_json and isinstance(content, string_or_bytes):
Expand Down
5 changes: 4 additions & 1 deletion gcloud/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class ServiceUnavailable(ServerError):
code = 503


def make_exception(response, content, use_json=True):
def make_exception(response, content, request_string=None, use_json=True):
"""Factory: create exception based on HTTP response code.

:type response: :class:`httplib2.Response` or other HTTP response object
Expand Down Expand Up @@ -187,6 +187,9 @@ def make_exception(response, content, use_json=True):
message = payload.get('error', {}).get('message', '')
errors = payload.get('error', {}).get('errors', ())

if request_string:
message += ' (%s)' % request_string

This comment was marked as spam.

This comment was marked as spam.


try:
klass = _HTTP_CODE_TO_EXCEPTION[response.status]
except KeyError:
Expand Down