diff options
-rw-r--r-- | modules/tracking.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/tracking.py b/modules/tracking.py index 478ae9d..3fd6638 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -110,6 +110,10 @@ class PostenModule(TrackingModule): def get_xml(self, url): try: u = urllib2.urlopen(url, timeout = config.getfloat(cfg_section, 'timeout')) + except urllib2.HTTPError as e: + if e.code == 404: + raise NoPackageFound('No packages found') + raise PackageError(str(e)) except Exception as e: raise PackageError(str(e)) if u.headers['content-type'].startswith('application/xml'): @@ -331,6 +335,9 @@ class Module: for row in consignments: try: self.track_update(row.code, propagate_error = True) + except NoPackageFound: + results.append('No packages found for %s' % unicode(row)) + continue except PackageError as e: results.append('Failed to fetch data for %s.' % unicode(row)) continue |