Applying Northern-Lights recommendation of handling generic exceptions via except

This commit is contained in:
martynhare 2018-09-08 18:39:35 +01:00
parent 12a9b599bf
commit a9215eb247

View file

@ -176,7 +176,6 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def _on_update_triggered(self): def _on_update_triggered(self):
pw_name = "(UID error)"
if self.daemon_connected: if self.daemon_connected:
self._status_label.setText("running") self._status_label.setText("running")
self._status_label.setStyleSheet('color: green') self._status_label.setStyleSheet('color: green')
@ -206,6 +205,8 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
pw_name = pwd.getpwuid(int(uid)).pw_name pw_name = pwd.getpwuid(int(uid)).pw_name
except KeyError: except KeyError:
pw_name = "(UID error)" pw_name = "(UID error)"
except Exception:
pw_name = "error"
finally: finally:
by_users["%s (%s)" % (pw_name, uid)] = hits by_users["%s (%s)" % (pw_name, uid)] = hits
else: else: