aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-08-26 20:50:04 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-08-26 20:50:04 +0200
commiteb2d44760d4f2d4b12888bf98e6a73fc1486c919 (patch)
tree1229873530711f7f241ebe7a45350e9ed9cae7b2
parent675eddac950dbeeae4d3e594592f96ce385fe236 (diff)
downloadwee-slack-eb2d44760d4f2d4b12888bf98e6a73fc1486c919.tar.gz
Print user friendly error in handle_conversationsmembers
Fixes parts of #714
-rw-r--r--wee_slack.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 164490d..d89945e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2760,8 +2760,13 @@ def handle_history(message_json, eventrouter, **kwargs):
def handle_conversationsmembers(members_json, eventrouter, **kwargs):
request_metadata = members_json['wee_slack_request_metadata']
team = eventrouter.teams[request_metadata.team_hash]
- channel = team.channels[request_metadata.channel_identifier]
- channel.members = set(members_json['members'])
+ if members_json['ok']:
+ channel = team.channels[request_metadata.channel_identifier]
+ channel.members = set(members_json['members'])
+ else:
+ channel = team.channels[request_metadata.channel_identifier]
+ w.prnt(team.channel_buffer, '{}Couldn\'t load members for channel {}. Error: {}'
+ .format(w.prefix('error'), channel.name, members_json['error']))
def handle_usersinfo(user_json, eventrouter, **kwargs):