Bug 1401183: raise KeyError from list_artifacts when none is found; r=glandium
authorDustin J. Mitchell <dustin@mozilla.com>
Thu, 14 Sep 2017 23:30:58 +0000
changeset 431580 83fdd1638d8e024167520b38deda513f6ce1d6cf
parent 431579 cb6711fd369452c089aa9a2d026639743f6a2cff
child 431581 1459712dc9cae49898e4aa2a89f4b6836c522946
push id7785
push userryanvm@gmail.com
push dateThu, 21 Sep 2017 13:39:55 +0000
treeherdermozilla-beta@06d4034a8a03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1401183
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1401183: raise KeyError from list_artifacts when none is found; r=glandium MozReview-Commit-ID: TqON8joEd6
taskcluster/taskgraph/util/taskcluster.py
--- a/taskcluster/taskgraph/util/taskcluster.py
+++ b/taskcluster/taskgraph/util/taskcluster.py
@@ -78,17 +78,22 @@ def get_index_url(index_path, use_proxy=
     if use_proxy:
         INDEX_URL = 'http://taskcluster/index/v1/task/{}'
     else:
         INDEX_URL = 'https://index.taskcluster.net/v1/task/{}'
     return INDEX_URL.format(index_path)
 
 
 def find_task_id(index_path, use_proxy=False):
-    response = _do_request(get_index_url(index_path, use_proxy))
+    try:
+        response = _do_request(get_index_url(index_path, use_proxy))
+    except requests.exceptions.HTTPError as e:
+        if e.response.status_code == 404:
+            raise KeyError("index path {} not found".format(index_path))
+        raise
     return response.json()['taskId']
 
 
 def get_artifact_from_index(index_path, artifact_path, use_proxy=False):
     full_path = index_path + '/artifacts/' + artifact_path
     response = _do_request(get_index_url(full_path, use_proxy))
     return _handle_artifact(full_path, response)