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>
changes/77/6049877/2
Andrew Grieve 1 year ago committed by LUCI CQ
parent 885ed47343
commit 0b3c297363

@ -356,7 +356,10 @@ class MyActivity(object):
url = url + '?' + query_data
_, body = http.request(url)
self.show_progress()
content = json.loads(body)
try:
content = json.loads(body)
except json.JSONDecodeError:
content = None
if not content:
logging.error('Unable to parse %s response from monorail.', project)
return []

Loading…
Cancel
Save