Skip to content
Snippets Groups Projects
Commit 15f5178f authored by inso's avatar inso
Browse files

Fix crash #357

parent b86bc2ce
Branches
Tags
No related merge requests found
...@@ -5,15 +5,13 @@ Created on 21 févr. 2015 ...@@ -5,15 +5,13 @@ Created on 21 févr. 2015
""" """
from ucoinpy.documents.peer import Peer, Endpoint, BMAEndpoint from ucoinpy.documents.peer import Peer, Endpoint, BMAEndpoint
from ucoinpy.documents import Block, BlockId from ucoinpy.documents import Block, BlockId, MalformedDocumentError
from ...tools.exceptions import InvalidNodeCurrency from ...tools.exceptions import InvalidNodeCurrency
from ...tools.decorators import asyncify from ...tools.decorators import asyncify
from ucoinpy.api import bma as bma from ucoinpy.api import bma as bma
from ucoinpy.api.bma import ConnectionHandler from ucoinpy.api.bma import ConnectionHandler
import json from aiohttp.errors import WSClientDisconnectedError, WSServerHandshakeError, ClientResponseError
from aiohttp.errors import ClientError, DisconnectedError, TimeoutError, \
WSClientDisconnectedError, WSServerHandshakeError, ClientResponseError
from aiohttp.errors import ClientError, DisconnectedError from aiohttp.errors import ClientError, DisconnectedError
from asyncio import TimeoutError from asyncio import TimeoutError
import logging import logging
...@@ -588,11 +586,14 @@ class Node(QObject): ...@@ -588,11 +586,14 @@ class Node(QObject):
def refresh_peer_data(self, peer_data): def refresh_peer_data(self, peer_data):
if "raw" in peer_data: if "raw" in peer_data:
try:
str_doc = "{0}{1}\n".format(peer_data['raw'], str_doc = "{0}{1}\n".format(peer_data['raw'],
peer_data['signature']) peer_data['signature'])
peer_doc = Peer.from_signed_raw(str_doc) peer_doc = Peer.from_signed_raw(str_doc)
pubkey = peer_data['pubkey'] pubkey = peer_data['pubkey']
self.neighbour_found.emit(peer_doc, pubkey) self.neighbour_found.emit(peer_doc, pubkey)
except MalformedDocumentError as e:
logging.debug(str(e))
else: else:
logging.debug("Incorrect leaf reply") logging.debug("Incorrect leaf reply")
......
...@@ -8,9 +8,10 @@ import logging ...@@ -8,9 +8,10 @@ import logging
import asyncio import asyncio
import aiohttp import aiohttp
from PyQt5.QtWidgets import QDialog, QMenu, QMessageBox, QApplication from ucoinpy.documents import MalformedDocumentError
from PyQt5.QtWidgets import QDialog, QMenu, QApplication
from PyQt5.QtGui import QCursor from PyQt5.QtGui import QCursor
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject from PyQt5.QtCore import pyqtSignal, QObject
from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog
from ..models.peering import PeeringTreeModel from ..models.peering import PeeringTreeModel
...@@ -73,7 +74,7 @@ class StepPageInit(Step): ...@@ -73,7 +74,7 @@ class StepPageInit(Step):
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
except aiohttp.errors.ClientError as e: except aiohttp.errors.ClientError as e:
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
except ValueError as e: except (MalformedDocumentError, ValueError) as e:
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
@asyncify @asyncify
...@@ -101,7 +102,7 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2]))) ...@@ -101,7 +102,7 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
except aiohttp.errors.ClientError as e: except aiohttp.errors.ClientError as e:
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
except ValueError as e: except (MalformedDocumentError, ValueError) as e:
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
@asyncify @asyncify
...@@ -144,7 +145,7 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2]))) ...@@ -144,7 +145,7 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
except aiohttp.errors.ClientError as e: except aiohttp.errors.ClientError as e:
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
except ValueError as e: except (MalformedDocumentError, ValueError) as e:
self.config_dialog.label_error.setText(str(e)) self.config_dialog.label_error.setText(str(e))
def is_valid(self): def is_valid(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment