Skip to content

Commit eef4cb8

Browse files
authored
Merge pull request #20 from sirstudly/fix_comet_exception_handling
Fixing up Comet exception handling
2 parents b37191c + 0e48384 commit eef4cb8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scraper/services/comet.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ def request(func, *args):
2727
try:
2828
json_response = json.loads(response.content, object_hook=lambda d: SimpleNamespace(**d))
2929
except Exception as e:
30-
ui_print('[comet] error: unable to parse response:' + response.content.decode("utf-8") + " " + str(e))
30+
if hasattr(response, "content"):
31+
ui_print('[comet] error: unable to parse response:' + response.content.decode("utf-8"))
32+
else:
33+
ui_print('[comet] error: unable to parse response.')
34+
ui_print('[comet] ' + str(e), ui_settings.debug)
3135
return []
3236
return json_response
3337

0 commit comments

Comments
 (0)