]> git.cworth.org Git - turbot/commitdiff
Restore handling of error events from Slack
authorCarl Worth <cworth@cworth.org>
Sat, 26 Sep 2020 05:02:45 +0000 (22:02 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 26 Sep 2020 05:06:41 +0000 (22:06 -0700)
This is better than what I had copied from the example a few commits
ago because this properly logs through the python logging system, (so
the error message will appear in the Apache log file).

turbot.py

index 92921a2dc8aedd92bedbcd6fd7fe5fd26877bde4..6c0d8b96d80889c10ad0659dad5531b892d326de 100755 (executable)
--- a/turbot.py
+++ b/turbot.py
@@ -14,5 +14,9 @@ slack_bot_token = os.environ['SLACK_BOT_TOKEN']
 slack_events = SlackEventAdapter(slack_signing_secret, "/slack/events", app)
 slack_client = WebClient(slack_bot_token)
 
+@slack_events.on("error")
+def handle_error(error):
+    app.logger.error("Error from Slack: " + str(error))
+
 if __name__ == '__main__':
     app.run(debug=True)