From: Michal Sojka Date: Wed, 27 Feb 2019 13:55:38 +0000 (+0100) Subject: Make config-related error message more informative X-Git-Url: http://rtime.felk.cvut.cz/gitweb/coffee/coffee-flask.git/commitdiff_plain/d42406c44c34afb3c734abee159d4343d8954b0e Make config-related error message more informative Without this information, it's hard to figure out why things do not work. --- diff --git a/app.py b/app.py index 389aa28..046ce98 100644 --- 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))