From 3f2ae1112b66ec1ec205d355ba2253d8fa30885d Mon Sep 17 00:00:00 2001 From: Vratislav Podzimek Date: Mon, 6 Jul 2015 13:36:55 +0200 Subject: [PATCH 6/9] React better on network issues (#1236657) Instead of raising an exception we should let users know that there was a network error. Signed-off-by: Vratislav Podzimek --- org_fedora_oscap/gui/spokes/oscap.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py index 6656108..5e5a43e 100644 --- a/org_fedora_oscap/gui/spokes/oscap.py +++ b/org_fedora_oscap/gui/spokes/oscap.py @@ -277,10 +277,16 @@ class OSCAPSpoke(NormalSpoke): if any(self._addon_data.content_url.startswith(net_prefix) for net_prefix in data_fetch.NET_URL_PREFIXES): # need to fetch data over network - thread_name = common.wait_and_fetch_net_data( + try: + thread_name = common.wait_and_fetch_net_data( self._addon_data.content_url, self._addon_data.raw_preinst_content_path, self._addon_data.certificates) + except common.OSCAPaddonNetworkError: + self._network_problem() + with self._fetch_flag_lock: + self._fetching = False + return # pylint: disable-msg=E1101 hubQ.send_message(self.__class__.__name__, @@ -623,6 +629,14 @@ class OSCAPSpoke(NormalSpoke): self._wrong_content() @gtk_action_wait + def _network_problem(self): + """Adapts the UI if network error was encountered during data fetch""" + + self._progress_label.set_markup("%s" % _("Network error encountered when fetching data." + " Please check that network is setup and working.")) + self._wrong_content() + + @gtk_action_wait def _extraction_failed(self, err_msg): """Adapts the UI if extracting data from entered URL failed""" -- 2.4.3