Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit 3c9fa7e

Browse files
committed
Improve error handling
1 parent 25c5eda commit 3c9fa7e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ubports-qa

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def list_lists():
4848
def add_list(branch):
4949
if list_exists(branch):
5050
return
51+
if requests.get("http://repo.ubports.com/dists/" + branch).status_code != 200:
52+
die("PPA not found")
5153
with open(get_list_file(branch),"w+") as list:
5254
list.write("deb http://repo.ubports.com/ %s main" % branch)
5355

@@ -58,12 +60,15 @@ def remove_list(branch):
5860
os.remove(get_list_file(branch))
5961

6062
def get_github_pr(repo, num):
61-
return requests.get(GITHUB_API_PULLREQUEST % (repo, num)).json()
63+
ret = requests.get(GITHUB_API_PULLREQUEST % (repo, num))
64+
if ret.status_code != 200:
65+
die("Pull-Request not found")
66+
return ret.json()
6267

6368
def get_jenkins_build(repo, ref):
6469
ret = requests.get(JENKINS_API_BUILD % (repo, ref))
6570
if ret.status_code != 200:
66-
die("Not found")
71+
die("Jenkins build not found")
6772
return ret.json()
6873

6974
def get_issue_status(repo, ref):

0 commit comments

Comments
 (0)