Bug 1407163: raise exceptions with HTTP error info; r?glandium draft
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 12 Jan 2018 17:19:58 +0000
changeset 719703 f546b319fe94de087978b9886b15ee425444476d
parent 719102 c4e4613dbe32bb218957a140e5d0bd4fe7d1e98c
child 745884 6a94324c1e2bd8c074d68f92f18572459f8abcb8
push id95350
push userdmitchell@mozilla.com
push dateFri, 12 Jan 2018 17:20:42 +0000
reviewersglandium
bugs1407163
milestone59.0a1
Bug 1407163: raise exceptions with HTTP error info; r?glandium MozReview-Commit-ID: B3MvsZDpj9a
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1284,29 +1284,29 @@ class PackageFrontend(MachCommandBase):
                 if self.size is None and self.digest is None:
                     return True
                 return super(DownloadRecord, self).validate()
 
         class ArtifactRecord(DownloadRecord):
             def __init__(self, task_id, artifact_name):
                 cot = cache._download_manager.session.get(
                     get_artifact_url(task_id, 'public/chainOfTrust.json.asc'))
+                cot.raise_for_status()
                 digest = algorithm = None
-                if cot.status_code == 200:
-                    # The file is GPG-signed, but we don't care about validating
-                    # that. Instead of parsing the PGP signature, we just take
-                    # the one line we're interested in, which starts with a `{`.
-                    data = {}
-                    for l in cot.content.splitlines():
-                        if l.startswith('{'):
-                            try:
-                                data = json.loads(l)
-                                break
-                            except Exception:
-                                pass
+                data = {}
+                # The file is GPG-signed, but we don't care about validating
+                # that. Instead of parsing the PGP signature, we just take
+                # the one line we're interested in, which starts with a `{`.
+                for l in cot.content.splitlines():
+                    if l.startswith('{'):
+                        try:
+                            data = json.loads(l)
+                            break
+                        except Exception:
+                            pass
                 for algorithm, digest in (data.get('artifacts', {})
                                               .get(artifact_name, {}).items()):
                     pass
 
                 name = os.path.basename(artifact_name)
                 artifact_url = get_artifact_url(task_id, artifact_name,
                     use_proxy=not artifact_name.startswith('public/'))
                 super(ArtifactRecord, self).__init__(