From babc631b194842f62d6d761f7bc59c60d865c382 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Wed, 14 Dec 2016 11:11:14 +0100 Subject: [PATCH] Improve message when application pyconf cannot be read --- commands/config.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/commands/config.py b/commands/config.py index 9023b07..b27922f 100644 --- a/commands/config.py +++ b/commands/config.py @@ -24,6 +24,7 @@ import gettext import sys import src +from cookielib import logger # internationalization satdir = os.path.dirname(os.path.realpath(__file__)) @@ -406,18 +407,22 @@ class ConfigManager: "There is an error in the file" " %s.pyconf.\n" % cfg.VARS.application)) do_merge = False - except: + except Exception as e: if (not ('-e' in parser.parse_args()[1]) or ('--edit' in parser.parse_args()[1]) and command == 'config'): + sys.stdout.write(src.printcolors.printcWarning("%s\n" % str(e))) raise src.SatException(_("Error in configuration file:" " %(application)s.pyconf\n") % \ { 'application': application} ) else: sys.stdout.write(src.printcolors.printcWarning( - "There is an error in the file" - " %s.pyconf. Opening the file with the" - " default viewer\n" % cfg.VARS.application)) + "There is an error in the file" + " %s.pyconf. Opening the file with the" + " default viewer\n" % cfg.VARS.application)) + sys.stdout.write("The error:" + " %s\n" % src.printcolors.printcWarning( + str(e))) do_merge = False if do_merge: -- 2.39.2