Browse Source

in case of an error accessing the BTS, throw a new exception, and catch it in the main program, and display a message about it

master
Sandro Tosi 7 years ago
parent
commit
4ece52c2a2
  1. 4
      bin/reportbug
  2. 5
      debian/changelog
  3. 8
      reportbug/debbugs.py
  4. 4
      reportbug/exceptions.py

4
bin/reportbug

@ -56,7 +56,7 @@ from reportbug.tempfiles import (
)
from reportbug.exceptions import (
UINotImportable, UINotImplemented,
NoNetwork, NoPackage, NoBugs, NoReport,
NoNetwork, NoPackage, NoBugs, NoReport, QuertBTSError,
)
from reportbug import submit
from reportbug import checkversions
@ -1739,6 +1739,8 @@ class UI(object):
else:
ewrite('Nothing new to report; exiting.\n')
return
except QuertBTSError:
ewrite('Error accessing the BTS, no bugs information available.\n')
if self.options.queryonly and not exinfo:
return

5
debian/changelog

@ -6,8 +6,11 @@ reportbug (6.6.5) UNRELEASED; urgency=medium
* debian/control
- set dep on python-debianbts to the version implementing the paged access
to BTS; Closes: #796759
* bin/reportbug, reportbug/{debbugs.py, exceptions.py}
- in case of an error accessing the BTS, throw a new exception, and catch it
in the main program, and display a message about it
-- Sandro Tosi <morph@debian.org> Sat, 29 Aug 2015 21:46:46 +0100
-- Sandro Tosi <morph@debian.org> Sat, 29 Aug 2015 21:48:09 +0100
reportbug (6.6.4) unstable; urgency=medium

8
reportbug/debbugs.py

@ -43,6 +43,7 @@ from collections import defaultdict
import checkversions
from exceptions import (
NoNetwork,
QuertBTSError,
)
from urlutils import open_url
@ -1285,8 +1286,11 @@ def get_reports(package, timeout, system='debian', mirrors=None, version=None,
else:
bugs = map(int, package)
# retrieve bugs and generate the hierarchy
stats = debianbts.get_status(bugs)
try:
# retrieve bugs and generate the hierarchy
stats = debianbts.get_status(bugs)
except:
raise QuertBTSError
d = defaultdict(list)
for s in stats:

4
reportbug/exceptions.py

@ -57,3 +57,7 @@ class InvalidRegex(reportbug_exception):
# Lame empty exception used later to save some coding
class NoMessage(reportbug_exception):
pass
# There was a problem accessing BTS
class QuertBTSError(reportbug_exception):
pass
Loading…
Cancel
Save