]> git.cworth.org Git - turbot/blobdiff - turbot/events.py
Create the hunts table if it doesn't already exist
[turbot] / turbot / events.py
index 8cb6d1e061c673d491f44ca19963f0c9f7c4b1cd..32d061ab1bb62da91655891beb9c626d7859d6c4 100644 (file)
@@ -22,8 +22,12 @@ def home(turb, user_id, body):
     The return value is a dictionary suitable to be published to the
     Slack views_publish API."""
 
-    response = turb.db.Table("hunts").scan()
-    hunts = response['Items']
+    # Behave cleanly if there is not hunts table at all yet.
+    try:
+        response = turb.db.Table("hunts").scan()
+        hunts = response['Items']
+    except:
+        hunts = []
 
     return {
         "type": "home",