Bug 1445683 - Handle JSONDecodeError in aom vendor command; r=chmanchester
authorDan Minor <dminor@mozilla.com>
Thu, 17 May 2018 10:37:16 -0400
changeset 818886 a77a850eead4b0596c0fe942829c5a145d0d49f8
parent 818885 b13d106a0a8635915ed58a297fe4bb9e8d30a598
child 818887 383fb5a261ffb2075b014a42c676eda91d1193c3
push id116388
push userrwood@mozilla.com
push dateMon, 16 Jul 2018 19:48:57 +0000
reviewerschmanchester
bugs1445683
milestone63.0a1
Bug 1445683 - Handle JSONDecodeError in aom vendor command; r=chmanchester MozReview-Commit-ID: 9MgxqkoHnfw
python/mozbuild/mozbuild/vendor_aom.py
--- 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},