From 586197d591e56733e4356ef51e5c7477c12d490a Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Wed, 17 Oct 2012 22:14:23 +0200 Subject: [PATCH] pull-lp-source: Catch errors parsing JSON we got from DDE (LP: #1059848) --- debian/changelog | 1 + pull-lp-source | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 29929d7..455deb2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,7 @@ ubuntu-dev-tools (0.144) UNRELEASED; urgency=low (LP: #936014) * ubuntutools.question: Catch EOF and SIGINT on all input and bail out. (LP: #1037488) + * pull-lp-source: Catch errors parsing JSON we got from DDE (LP: #1059848) [ Benjamin Drung ] * seeded-in-ubuntu: State in error message that it takes a source package. diff --git a/pull-lp-source b/pull-lp-source index bd3d48a..392abf1 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -47,12 +47,14 @@ def source_package_for(binary, release): """ url = ('http://dde.debian.net/dde/q/udd/dist/d:ubuntu/r:%s/p:%s/?t=json' % (release, binary)) + data = None try: data = json.load(urllib2.urlopen(url))['r'] except urllib2.URLError, e: Logger.error('Unable to retrieve package information from DDE: ' '%s (%s)', url, str(e)) - return None + except ValueError: + Logger.error('Unable to parse the response from DDE.') if not data: return None return data[0]['source']