Skip to content
Snippets Groups Projects
Commit 79e361b6 authored by inso's avatar inso
Browse files

Hide big errors

parent 516a9fa1
No related branches found
No related tags found
No related merge requests found
...@@ -9,3 +9,4 @@ pytest-asyncio<0.6 ...@@ -9,3 +9,4 @@ pytest-asyncio<0.6
pyyaml pyyaml
aiohttp aiohttp
async_timeout async_timeout
PyQt5>=5.5
\ No newline at end of file
...@@ -118,6 +118,11 @@ class NodeConnector(QObject): ...@@ -118,6 +118,11 @@ class NodeConnector(QObject):
except jsonschema.ValidationError as e: except jsonschema.ValidationError as e:
self._logger.debug(str(e)) self._logger.debug(str(e))
self.change_state_and_emit(Node.CORRUPTED) self.change_state_and_emit(Node.CORRUPTED)
except RuntimeError:
if self.session.closed:
pass
else:
raise
async def init_session(self): async def init_session(self):
if not self.session: if not self.session:
...@@ -137,6 +142,7 @@ class NodeConnector(QObject): ...@@ -137,6 +142,7 @@ class NodeConnector(QObject):
closed = True closed = True
await asyncio.sleep(0) await asyncio.sleep(0)
await self.session.close() await self.session.close()
await asyncio.sleep(0)
def refresh(self, manual=False): def refresh(self, manual=False):
""" """
...@@ -184,6 +190,11 @@ class NodeConnector(QObject): ...@@ -184,6 +190,11 @@ class NodeConnector(QObject):
self._logger.debug(str(e)) self._logger.debug(str(e))
self._logger.debug("Validation error") self._logger.debug("Validation error")
self.change_state_and_emit(Node.CORRUPTED) self.change_state_and_emit(Node.CORRUPTED)
except RuntimeError:
if self.session.closed:
pass
else:
raise
finally: finally:
self._connected['block'] = False self._connected['block'] = False
self._ws_tasks['block'] = None self._ws_tasks['block'] = None
...@@ -308,6 +319,11 @@ class NodeConnector(QObject): ...@@ -308,6 +319,11 @@ class NodeConnector(QObject):
except jsonschema.ValidationError as e: except jsonschema.ValidationError as e:
self._logger.debug(str(e)) self._logger.debug(str(e))
self.change_state_and_emit(Node.CORRUPTED) self.change_state_and_emit(Node.CORRUPTED)
except RuntimeError:
if self.session.closed:
pass
else:
raise
finally: finally:
self._connected['peer'] = False self._connected['peer'] = False
self._ws_tasks['peer'] = None self._ws_tasks['peer'] = None
......
...@@ -88,6 +88,7 @@ def main(): ...@@ -88,6 +88,7 @@ def main():
sakia.setStyle('Fusion') sakia.setStyle('Fusion')
loop = QSelectorEventLoop(sakia) loop = QSelectorEventLoop(sakia)
loop.set_exception_handler(async_exception_handler) loop.set_exception_handler(async_exception_handler)
#loop.set_debug(True)
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
with loop: with loop:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment