We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c952fd0 commit b7122b3Copy full SHA for b7122b3
googleapiclient/errors.py
@@ -52,8 +52,12 @@ def _get_reason(self):
52
reason = self.resp.reason
53
try:
54
data = json.loads(self.content.decode('utf-8'))
55
- reason = data['error']['message']
56
- except (ValueError, KeyError):
+ if isinstance(data, dict):
+ reason = data['error']['message']
57
+ elif isinstance(data, list) and len(data) > 0:
58
+ first_error = data[0]
59
+ reason = first_error['error']['message']
60
+ except (ValueError, KeyError, TypeError):
61
pass
62
if reason is None:
63
reason = ''
0 commit comments