diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2022-02-01 23:48:54 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2022-09-18 16:36:55 +0200 |
commit | 81b1984c2f1d1513d0a6d1d1eed9b3dcef33009f (patch) | |
tree | aa1437ff70012e6da091e3e317650b8f7b437c90 /wee_slack.py | |
parent | 3e81d934282e0067be8d9e8289a14b829d44f687 (diff) | |
download | wee-slack-81b1984c2f1d1513d0a6d1d1eed9b3dcef33009f.tar.gz |
Show which requests fail at startup
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/wee_slack.py b/wee_slack.py index 98f0c0b..4d0ff63 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1544,7 +1544,7 @@ class SlackTeam(object): users, bots, channels, - **kwargs + **kwargs, ): self.slack_api_translator = copy.deepcopy(SLACK_API_TRANSLATOR) self.identifier = team_info["id"] @@ -6749,12 +6749,13 @@ def initiate_connection(token): "prefs": False, "presence": False, }, + "errors": [], } def handle_initial(data_type): def handle(response_json, eventrouter, team, channel, metadata): if not response_json["ok"]: - initial_data["error"] = response_json["error"] + initial_data["errors"].append(f'{data_type}: {response_json["error"]}') initial_data["complete"][data_type] = True create_team(token, initial_data) return @@ -6769,7 +6770,7 @@ def initiate_connection(token): def handle_prefs(response_json, eventrouter, team, channel, metadata): if not response_json["ok"]: - initial_data["error"] = response_json["error"] + initial_data["errors"].append(f'prefs: {response_json["error"]}') initial_data["complete"]["prefs"] = True create_team(token, initial_data) return @@ -6780,7 +6781,7 @@ def initiate_connection(token): def handle_getPresence(response_json, eventrouter, team, channel, metadata): if not response_json["ok"]: - initial_data["error"] = response_json["error"] + initial_data["errors"].append(f'presence: {response_json["error"]}') initial_data["complete"]["presence"] = True create_team(token, initial_data) return @@ -6835,11 +6836,11 @@ def initiate_connection(token): def create_team(token, initial_data): if all(initial_data["complete"].values()): - if "error" in initial_data: + if initial_data["errors"]: w.prnt( "", "ERROR: Failed connecting to Slack with token {}: {}".format( - token_for_print(token), initial_data["error"] + token_for_print(token), ", ".join(initial_data["errors"]) ), ) if not re.match(r"^xo\w\w(-\d+){3}-[0-9a-f]+(:.*)?$", token): |