From e3f9f95fb1d0bb51ac632c0da46fe056867b1c13 Mon Sep 17 00:00:00 2001 From: taizan-hokuto <55448286+taizan-hokuto@users.noreply.github.com> Date: Fri, 24 Jul 2020 15:19:32 +0900 Subject: [PATCH] Fix exception handling --- pytchat/core_async/livechat.py | 12 ++++++------ pytchat/core_multithread/livechat.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pytchat/core_async/livechat.py b/pytchat/core_async/livechat.py index 2cc3ff8..fac41ad 100644 --- a/pytchat/core_async/livechat.py +++ b/pytchat/core_async/livechat.py @@ -333,12 +333,12 @@ class LiveChatAsync: ''' if self.is_alive(): self.terminate() - try: - self.listen_task.result() - except Exception as e: - self.exception = e - if not isinstance(e, exceptions.ChatParseException): - self._logger.error(f'Internal exception - {type(e)}{str(e)}') + try: + self.listen_task.result() + except Exception as e: + self.exception = e + if not isinstance(e, exceptions.ChatParseException): + self._logger.error(f'Internal exception - {type(e)}{str(e)}') self._logger.info(f'[{self._video_id}]終了しました') def raise_for_status(self): diff --git a/pytchat/core_multithread/livechat.py b/pytchat/core_multithread/livechat.py index 7f99c55..f4a2513 100644 --- a/pytchat/core_multithread/livechat.py +++ b/pytchat/core_multithread/livechat.py @@ -324,12 +324,12 @@ class LiveChat: ''' if self.is_alive(): self.terminate() - try: - self.listen_task.result() - except Exception as e: - self.exception = e - if not isinstance(e, exceptions.ChatParseException): - self._logger.error(f'Internal exception - {type(e)}{str(e)}') + try: + self.listen_task.result() + except Exception as e: + self.exception = e + if not isinstance(e, exceptions.ChatParseException): + self._logger.error(f'Internal exception - {type(e)}{str(e)}') self._logger.info(f'[{self._video_id}]終了しました') def raise_for_status(self):