From 0fc9d14780ebe567de880d8ba5b4ea50d0714455 Mon Sep 17 00:00:00 2001 From: taizan-hokuto <55448286+taizan-hokuto@users.noreply.github.com> Date: Thu, 2 Jan 2020 21:14:22 +0900 Subject: [PATCH] Fix handling exception --- pytchat/parser/live.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pytchat/parser/live.py b/pytchat/parser/live.py index 031c031..f0fd176 100644 --- a/pytchat/parser/live.py +++ b/pytchat/parser/live.py @@ -9,7 +9,8 @@ from .. import config from .. exceptions import ( ResponseContextError, NoContentsException, - NoContinuationsException ) + NoContinuationsException, + ChatParseException ) logger = config.logger(__name__) @@ -22,7 +23,7 @@ class Parser: def get_contents(self, jsn): if jsn is None: - return {'timeoutMs':0,'continuation':None},[] + raise ChatParseException('Called with none JSON object.') if jsn['response']['responseContext'].get('errors'): raise ResponseContextError('The video_id would be wrong, or video is deleted or private.') contents=jsn['response'].get('continuationContents')