aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-09-16 22:58:02 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-09-16 23:52:11 +0200
commit1e040228ee639fa939f2cc391c4038a039a50d59 (patch)
tree1c11abfe9950d936b0a33b7b77ca7eb2c30a3a68
parent5608e22cdeb9ba3a07e2925fc97bb47bcbbc17da (diff)
downloadwee-slack-1e040228ee639fa939f2cc391c4038a039a50d59.tar.gz
Print error message when initial connection fails
I chose to print this instead of using dbg since it's a rather critical error message. Fixes #432
-rw-r--r--wee_slack.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 3904ab0..b1ccb09 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2031,10 +2031,9 @@ def handle_rtmstart(login_data, eventrouter):
"""
This handles the main entry call to slack, rtm.start
"""
- if login_data["ok"]:
-
- metadata = pickle.loads(login_data["wee_slack_request_metadata"])
+ metadata = pickle.loads(login_data["wee_slack_request_metadata"])
+ if login_data["ok"]:
# Let's reuse a team if we have it already.
th = SlackTeam.generate_team_hash(login_data['self']['name'], login_data['team']['domain'])
if not eventrouter.teams.get(th):
@@ -2103,6 +2102,10 @@ def handle_rtmstart(login_data, eventrouter):
dbg("connected to {}".format(t.domain))
+ else:
+ w.prnt("", "ERROR: Failed connecting to Slack with token {}: {}"
+ .format(metadata.token, login_data["error"]))
+
# self.identifier = self.domain
def handle_channelsinfo(channel_json, eventrouter, **kwargs):