summaryrefslogtreecommitdiffstats
path: root/tools/roomservice.py
diff options
context:
space:
mode:
authorAnthony King <anthonydking@slimroms.net>2015-01-08 11:39:12 -0600
committerAdnan Begovic <adnan@cyngn.com>2015-10-06 18:05:40 -0700
commit365b1e2bf864d1394d0a2572c7e24d70c4ee07ae (patch)
treefc10028c2e7e24cfa5832083e5a4863a09b563a2 /tools/roomservice.py
parent2545b264be21c70b2c9be0c3d29e47e8bea08ac3 (diff)
downloadbuild-365b1e2bf864d1394d0a2572c7e24d70c4ee07ae.zip
build-365b1e2bf864d1394d0a2572c7e24d70c4ee07ae.tar.gz
build-365b1e2bf864d1394d0a2572c7e24d70c4ee07ae.tar.bz2
roomservice: Improve error handling on search
Use the relevant forms of 'except' for urllib and parsing instead of a general except which was performed too late anyways. Change-Id: Ia1fc89dd5a8a703fc0175aef7b6dd013a44a2c8e
Diffstat (limited to 'tools/roomservice.py')
-rwxr-xr-xtools/roomservice.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/roomservice.py b/tools/roomservice.py
index 5eef4ee..241ea26 100755
--- a/tools/roomservice.py
+++ b/tools/roomservice.py
@@ -55,16 +55,15 @@ def add_auth(githubreq):
if not depsonly:
githubreq = urllib.request.Request("https://api.github.com/search/repositories?q=%s+user:CyanogenMod+in:name+fork:true" % device)
add_auth(githubreq)
- result = json.loads(urllib.request.urlopen(githubreq).read().decode())
try:
- numresults = int(result['total_count'])
- except:
- print("Failed to search GitHub (offline?)")
+ result = json.loads(urllib.request.urlopen(githubreq).read().decode())
+ except urllib.error.URLError:
+ print("Failed to search GitHub")
sys.exit()
- if (numresults == 0):
- print("Could not find device %s on github.com/CyanogenMod" % device)
+ except ValueError:
+ print("Failed to parse return data from GitHub")
sys.exit()
- for res in result['items']:
+ for res in result.get('items', []):
repositories.append(res)
local_manifests = r'.repo/local_manifests'