Bug 1445683 - Handle JSONDecodeError in aom vendor command; r=chmanchester
MozReview-Commit-ID: 9MgxqkoHnfw
--- a/python/mozbuild/mozbuild/vendor_aom.py
+++ b/python/mozbuild/mozbuild/vendor_aom.py
@@ -58,24 +58,21 @@ Please set a repository url with --repo
url = mozpath.join(self.repo_url, '+', revision + '?format=JSON')
self.log(logging.INFO, 'fetch', {'url': url},
'Fetching commit id from {url}')
req = requests.get(url)
req.raise_for_status()
try:
info = req.json()
except ValueError as e:
- if 'No JSON object' in e.message:
- # As of 2017 May, googlesource sends 4 garbage characters
- # at the beginning of the json response. Work around this.
- # https://bugs.chromium.org/p/chromium/issues/detail?id=718550
- import json
- info = json.loads(req.text[4:])
- else:
- raise
+ # As of 2017 May, googlesource sends 4 garbage characters
+ # at the beginning of the json response. Work around this.
+ # https://bugs.chromium.org/p/chromium/issues/detail?id=718550
+ import json
+ info = json.loads(req.text[4:])
return (info['commit'], info['committer']['time'])
def upstream_github_commit(self, revision):
'''Query the github api for a git commit id and timestamp.'''
github_api = 'https://api.github.com/'
repo = urlparse(self.repo_url).path[1:]
url = mozpath.join(github_api, 'repos', repo, 'commits', revision)
self.log(logging.INFO, 'fetch', {'url': url},