From 497423ddc2819e317afd233e42f87c2656452969 Mon Sep 17 00:00:00 2001 From: Arksine Date: Tue, 27 Apr 2021 08:52:34 -0400 Subject: [PATCH] confighelper: log detailed parsing errors Signed-off-by: Eric Callahan --- moonraker/confighelper.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/moonraker/confighelper.py b/moonraker/confighelper.py index 9a44314..8764b04 100644 --- a/moonraker/confighelper.py +++ b/moonraker/confighelper.py @@ -116,13 +116,17 @@ def get_configuration(server, system_args): cfg_file_path = os.path.normpath(os.path.expanduser( system_args.configfile)) if not os.path.isfile(cfg_file_path): - raise ConfigError(f"Configuration File Not Found: '{cfg_file_path}''") + raise ConfigError( + f"Configuration File Not Found: '{cfg_file_path}''") + if not os.access(cfg_file_path, os.R_OK | os.W_OK): + raise ConfigError( + "Moonraker does not have Read/Write permission for " + f"config file at path '{cfg_file_path}'") config = configparser.ConfigParser(interpolation=None) try: config.read(cfg_file_path) - except Exception: - raise ConfigError(f"Error Reading Config: '{cfg_file_path}'") from None - + except Exception as e: + raise ConfigError(f"Error Reading Config: '{cfg_file_path}'") from e try: server_cfg = config['server'] except KeyError: