mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 02:31:29 +00:00
my_activity.py: Handle JSON parse errors
Getting a lot of "(401) Unauthorized" responses for these now. This at least makes the script not crash. Change-Id: Ib42ccbdb3326a0918015e9d5e1cc9392a9c1a469 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6049877 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Andrew Grieve <agrieve@chromium.org> Auto-Submit: Andrew Grieve <agrieve@chromium.org>
This commit is contained in:
@@ -356,7 +356,10 @@ class MyActivity(object):
|
|||||||
url = url + '?' + query_data
|
url = url + '?' + query_data
|
||||||
_, body = http.request(url)
|
_, body = http.request(url)
|
||||||
self.show_progress()
|
self.show_progress()
|
||||||
content = json.loads(body)
|
try:
|
||||||
|
content = json.loads(body)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
content = None
|
||||||
if not content:
|
if not content:
|
||||||
logging.error('Unable to parse %s response from monorail.', project)
|
logging.error('Unable to parse %s response from monorail.', project)
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user