From 04e4e5f1fec4712965b73adfdde3be8b37aee5ea Mon Sep 17 00:00:00 2001 From: Ole Artz Date: Fri, 4 Aug 2017 13:57:40 +0200 Subject: [PATCH] DASH: error message for broken --config --- python_suite/dashboard/dashboard.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python_suite/dashboard/dashboard.py b/python_suite/dashboard/dashboard.py index f43c7b1..9f88114 100755 --- a/python_suite/dashboard/dashboard.py +++ b/python_suite/dashboard/dashboard.py @@ -30,7 +30,7 @@ def static_content(path): def main(): global CONFIG - import argparse + import argparse, sys parser = argparse.ArgumentParser() parser.add_argument('--host', default='', help='The host (IP address) the web server should listen on.') @@ -43,7 +43,12 @@ def main(): args = parser.parse_args() with open(args.config, 'r') as f: - CONFIG = json.load(f) + try: + CONFIG = json.load(f) + except Exception as e: + sys.stderr.write("Error loading --config file.\n") + sys.stderr.write(str(e) + "\n") + sys.exit(1) run(host=args.host, port=args.port, debug=args.debug) -- 2.43.0