Improved error handling in send()

This commit is contained in:
Mads Marquart
2017-05-05 20:26:23 +02:00
parent f4165462dc
commit 3b4a369586

View File

@@ -539,7 +539,8 @@ class Client(object):
message_ids = []
try:
message_ids += [action['message_id'] for action in j['payload']['actions'] if 'message_id' in action]
except KeyError as e:
message_ids[0] # Try accessing element
except (KeyError, IndexError) as e:
log.warning('Error when sending message: No message ids could be found')
return False