slack import: Improve error handling for invalid messages.

This commit is contained in:
Tim Abbott
2018-04-18 11:29:40 -07:00
parent 86046ae9c3
commit 8e57a3958d

View File

@@ -668,10 +668,13 @@ def channel_message_to_zerver_message(realm_id: int, users: List[ZerverFieldsT],
continue continue
has_attachment = has_image = False has_attachment = has_image = False
content, mentioned_users_id, has_link = convert_to_zulip_markdown(message['text'], try:
users, content, mentioned_users_id, has_link = convert_to_zulip_markdown(
added_channels, message['text'], users, added_channels, added_users)
added_users) except Exception:
print("Slack message unexpectedly missing text representation:")
print(json.dumps(message, indent=4))
continue
rendered_content = None rendered_content = None
recipient_id = added_recipient[message['channel_name']] recipient_id = added_recipient[message['channel_name']]