]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/commitdiff
Make config-related error message more informative
authorMichal Sojka <michal.sojka@cvut.cz>
Wed, 27 Feb 2019 13:55:38 +0000 (14:55 +0100)
committerMichal Sojka <michal.sojka@cvut.cz>
Wed, 27 Feb 2019 13:55:38 +0000 (14:55 +0100)
Without this information, it's hard to figure out why things do not work.

app.py

diff --git a/app.py b/app.py
index 389aa2828c1e3017529a85de1772358ce3129425..046ce9857eccdd90feeb4bd03bd9b14b9edaa950 100644 (file)
--- a/app.py
+++ b/app.py
@@ -10,6 +10,7 @@ from io import BytesIO
 
 import coffee_db as db
 import time
+import sys
 from datetime import date, timedelta
 
 from json import loads
@@ -199,7 +200,8 @@ def tell_coffeebot():
         with open(".config", "r") as f:
             conf = loads(f.read())
     except:
-        return "Config needed! Please find in git history how it should look."
+        return "Config read error: '%s'! Please find in git history how the .config should look." \
+            % sys.exc_info()[1]
     try:
         res = post(conf["coffeebot"]["url"], json=what)
         print("res is {}".format(res))