Skip to content

Commit

Permalink
[cli] Catch parsing errors and notify user to make a bug report
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Jul 1, 2021
1 parent c3f390a commit a410537
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions chat_downloader/chat_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
RetriesExceeded,
NoContinuation,
UserNotFound,
ChatGeneratorError
ChatGeneratorError,
ParsingError
)


Expand Down Expand Up @@ -297,9 +298,11 @@ def log_on_inactivity_timeout():
output, indent=indent, sort_keys=sort_keys, overwrite=overwrite)

if output_file.is_default():
chat.callback = lambda x: output_file.write(chat.format(x), flush=True)
chat.callback = lambda x: output_file.write(
chat.format(x), flush=True)
else:
chat.callback = lambda x: output_file.write(x, flush=True)
chat.callback = lambda x: output_file.write(
x, flush=True)

chat.site = site_object

Expand Down Expand Up @@ -405,7 +408,8 @@ def callback(item):
) as e: # Expected errors
log('error', e)
except (
ChatGeneratorError
ChatGeneratorError,
ParsingError
) as e: # Errors which may be bugs
log('error', '{}. {}'.format(
e, 'Please report this at https://github.com/xenova/chat-downloader/issues/new/choose'))
Expand Down

0 comments on commit a410537

Please sign in to comment.