Bug 1401183: raise KeyError from list_artifacts when none is found; r?glandium
MozReview-Commit-ID: TqON8joEd6
--- 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)