Bug 1445683 - Handle JSONDecodeError in aom vendor command; r=chmanchester draft
authorDan Minor <dminor@mozilla.com>
Thu, 17 May 2018 10:37:16 -0400
changeset 811431 c11c5665bb42dbed9e84f0fb4c443bb9aab4173b
parent 811430 7f61f9df4a3e1b19cacdf3fad0d0e4ec17e5f428
child 811432 fe3ffc0776acb2a83bdf749c9e85c605baa636f3
child 811437 69add47ffe8af2282fa16ad96a2b328564324c22
push id114310
push userbmo:dminor@mozilla.com
push dateWed, 27 Jun 2018 17:14:11 +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},