Merge lp:~sergiusens/click-sync/404 into lp:click-sync

Proposed by Sergio Schvezov
Status: Merged
Approved by: Colin Watson
Approved revision: 9
Merged at revision: 9
Proposed branch: lp:~sergiusens/click-sync/404
Merge into: lp:click-sync
Diff against target: 15 lines (+5/-2)
1 file modified
click-sync.py (+5/-2)
To merge this branch: bzr merge lp:~sergiusens/click-sync/404
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+191655@code.launchpad.net

Description of the change

Instead of a traceback raise an exception on != 200 with the click package that odds out

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click-sync.py'
2--- click-sync.py 2013-10-16 19:23:37 +0000
3+++ click-sync.py 2013-10-17 14:47:27 +0000
4@@ -83,8 +83,11 @@
5 Jenkins uri.
6 """
7 log.debug(('Getting %s' % click_uri))
8- json_job_request = urllib.urlopen(click_uri).read()
9- json_content = json.loads(json_job_request)
10+ json_request = urllib.urlopen(click_uri)
11+ if json_request.code != 200:
12+ raise RuntimeError('%s returned %s with %s' %
13+ (click_uri, json_request.code, json_request.read()))
14+ json_content = json.loads(json_request.read())
15 return json_content
16
17

Subscribers

People subscribed via source and target branches