diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2022-09-18 13:11:50 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2022-09-18 16:36:55 +0200 |
commit | fee2398b6f7a3f66d8f9fb364f05ad1d31e7dc83 (patch) | |
tree | bb1250f2675c3bad4865286999d6daf42a621bc7 /wee_slack.py | |
parent | 9c5a4b1bc92a35df53fef6e0e3620e3db50ea734 (diff) | |
download | wee-slack-fee2398b6f7a3f66d8f9fb364f05ad1d31e7dc83.tar.gz |
Gracefully handle user_is_restricted error on initial load
If you are a guest on a team, requesting the user groups may fail with
this error. Instead of failing the whole startup, report an error and
continue.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index e0df044..7b0f38c 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -6788,7 +6788,16 @@ def initiate_connection(token): def handle_initial(data_type): def handle(response_json, eventrouter, team, channel, metadata): if not response_json["ok"]: - initial_data["errors"].append(f'{data_type}: {response_json["error"]}') + if response_json["error"] == "user_is_restricted": + w.prnt( + "", + "You are a restricted user in this team, " + f"{data_type} not loaded", + ) + else: + initial_data["errors"].append( + f'{data_type}: {response_json["error"]}' + ) initial_data["complete"][data_type] = True create_team(token, initial_data) return |