[Reportbug-commits] [reportbug] 10/12: dont crash if we cant access the BTS: Closes: #694634
Sandro Tosi
morph at moszumanska.debian.org
Fri Jan 1 18:37:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository reportbug.
commit 302af774a86d60dc5bbac6253424f35f8a23d5c0
Author: Sandro Tosi <morph at debian.org>
Date: Fri Jan 1 18:25:26 2016 +0000
dont crash if we cant access the BTS: Closes: #694634
---
debian/changelog | 4 +++-
reportbug/ui/gtk2_ui.py | 6 ++++--
reportbug/ui/text_ui.py | 17 ++++++++++-------
reportbug/ui/urwid_ui.py | 10 ++++++----
4 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 5b05bd7..8f7fe81 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,8 +38,10 @@ reportbug (6.6.6) UNRELEASED; urgency=medium
- remove reference to BROWSER env variable, we use xdg-open; Closes: #690759
* reportbug/urlutils.py
- remove handling of X11BROWSER and CONSOLEBROWSER, obsolete
+ * reportbug/ui/*
+ - dont crash if we cant access the BTS: Closes: #694634
- -- Sandro Tosi <morph at debian.org> Fri, 01 Jan 2016 17:37:06 +0000
+ -- Sandro Tosi <morph at debian.org> Fri, 01 Jan 2016 18:24:59 +0000
reportbug (6.6.5) unstable; urgency=medium
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index cf9937d..0415ed9 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -907,7 +907,11 @@ class HandleBTSQueryPage(TreePage):
(count, sectitle, hierarchy) = debbugs.get_reports(
package, timeout, bts, mirrors=mirrors, version=version,
http_proxy=http_proxy, archived=archived, source=source)
+ except:
+ error_dialog("Unable to connect to %s BTS." % sysinfo['name'])
+ raise NoBugs
+ try:
if not count:
if hierarchy is None:
raise NoPackage
@@ -931,8 +935,6 @@ class HandleBTSQueryPage(TreePage):
return(report, sectitle), {}
- except(IOError, NoNetwork):
- error_dialog("Unable to connect to %s BTS." % sysinfo['name'])
except NoPackage:
error_dialog('No record of this package found.')
raise NoPackage
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 6a8241e..3c98a32 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -534,7 +534,17 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
(count, title, hierarchy) = debbugs.get_reports(
package, timeout, bts, mirrors=mirrors, version=version,
source=source, http_proxy=http_proxy, archived=archived)
+ except Exception, e:
+ ewrite('Unable to connect to %s BTS (error: "%s"); ' % (debbugs.SYSTEMS[bts]['name'], repr(e)))
+ res = select_options('continue', 'yN',
+ {'y': 'Keep going.',
+ 'n': 'Abort.'})
+ if res == 'n':
+ raise NoNetwork
+ else:
+ raise NoBugs
+ try:
# If there's no report, then skip all the rest
if not count:
if hierarchy is None:
@@ -599,13 +609,6 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
mirrors, http_proxy, timeout, screen, title, package,
mbox_reader_cmd)
- except (IOError, NoNetwork):
- ewrite('Unable to connect to %s BTS; ', debbugs.SYSTEMS[bts]['name'])
- res = select_options('continue', 'yN',
- {'y': 'Keep going.',
- 'n': 'Abort.'})
- if res == 'n':
- raise NoNetwork
except NoPackage:
long_message('No record of this package found.')
raise NoPackage
diff --git a/reportbug/ui/urwid_ui.py b/reportbug/ui/urwid_ui.py
index 49e7424..53fd502 100644
--- a/reportbug/ui/urwid_ui.py
+++ b/reportbug/ui/urwid_ui.py
@@ -579,7 +579,13 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
(count, sectitle, hierarchy) = debbugs.get_reports(
package, timeout, bts, mirrors=mirrors, version=version,
http_proxy=http_proxy, archived=archived, source=source)
+ except Exception, e:
+ ui.run_wrapper(nullfunc)
+ long_message('Unable to connect to %s BTS.', sysinfo['name'],
+ title=title)
+ raise NoBugs
+ try:
if not count:
ui.run_wrapper(nullfunc)
if hierarchy is None:
@@ -640,10 +646,6 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
result = res
break
- except (IOError, NoNetwork):
- ui.run_wrapper(nullfunc)
- long_message('Unable to connect to %s BTS.', sysinfo['name'],
- title=title)
except NoPackage:
ui.run_wrapper(nullfunc)
long_message('No record of this package found.', title=title)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git
More information about the Reportbug-commits
mailing list