Skip to content

Commit

Permalink
Managed exceptions during the async thread loop (i.e. Not authorized).
Browse files Browse the repository at this point in the history
  • Loading branch information
anaselli committed Dec 29, 2024
1 parent e31f0ef commit c70a402
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dnfdragora/dnfd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ def __async_thread_loop(self, data, *args):
func(*args)
except Exception as err:
logger.error("__async_thread_loop (%s) proxy %s, method %s - Exception %s", str(data['cmd']), proxy.dbus_interface, method, err)
data['error'] = err
self._return_handler(err, data)
#data['error'] = err

# We enqueue one request at the time by now, monitoring _sent
self._sent = False
Expand Down
11 changes: 11 additions & 0 deletions dnfdragora/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,18 @@ def _manageDnfDaemonEvent(self):
if is_dict:
if 'error' in info.keys() and 'result' in info.keys():
if info['error']:
#got an Exception into trhead loop
logger.error("Event received %s, %s - status %s", event, info['error'], self._status)
title = _("Error in status %(status)s on %(event)s")%({'status':self._status, 'event':(event if event else "---")})
dialogs.warningMsgBox({'title' : title, "text": str(info['error']), "richtext":True})
# Force return on STARTUP on error
self.backend.reloadDaemon()
self.backend.clear_cache(also_groups=True)
self.packageQueue.clear()
self._status = DNFDragoraStatus.STARTUP
self._enableAction(False)
# force return on error
return False
elif info['result']:
is_list = isinstance(info['result'], list)
logger.debug("Event received %s, %s - status %s", event, len(info['result']) if is_list else info, self._status)
Expand Down

0 comments on commit c70a402

Please sign in to comment.