From c3373447df2958a0b8394c6945c94764f7209a17 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Tue, 15 Sep 2015 22:31:39 +0200 Subject: [PATCH] Handle some 404 errors with new communities --- src/cutecoin/core/net/node.py | 2 +- src/cutecoin/gui/community_tile.py | 13 +++++++++++++ src/cutecoin/gui/community_view.py | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/cutecoin/core/net/node.py b/src/cutecoin/core/net/node.py index 4c25fdbf..1a1326f2 100644 --- a/src/cutecoin/core/net/node.py +++ b/src/cutecoin/core/net/node.py @@ -303,7 +303,7 @@ class Node(QObject): block_data['number'])) self.changed.emit() except ValueError as e: - if '404' in e: + if '404' in str(e): self.set_block(None) logging.debug("Error in block reply") self.changed.emit() diff --git a/src/cutecoin/gui/community_tile.py b/src/cutecoin/gui/community_tile.py index 4d6c0f0c..5e820a5c 100644 --- a/src/cutecoin/gui/community_tile.py +++ b/src/cutecoin/gui/community_tile.py @@ -81,6 +81,19 @@ class CommunityTile(QFrame): </html>""".format(currency=self.community.currency, message=self.tr("Not connected")) self.text_label.setText(description) + except ValueError as e: + if '404' in str(e): + description = """<html> + <body> + <p> + <span style=" font-size:16pt; font-weight:600;">{currency}</span> + </p> + <p>{message}</p> + </body> + </html>""".format(currency=self.community.currency, + message=self.tr("Community not initialized")) + self.text_label.setText(description) + self.busy.hide() def mousePressEvent(self, event): diff --git a/src/cutecoin/gui/community_view.py b/src/cutecoin/gui/community_view.py index 86186a84..250242f6 100644 --- a/src/cutecoin/gui/community_view.py +++ b/src/cutecoin/gui/community_view.py @@ -192,6 +192,9 @@ class CommunityWidget(QWidget, Ui_CommunityWidget): except NoPeerAvailable as e: logging.debug(str(e)) text += " ( ### ) " + except NoPeerAvailable as e: + logging.debug(str(e)) + if len(self.community.network.synced_nodes) == 0: self.button_membership.setEnabled(False) -- GitLab