confighelper: log detailed parsing errors
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
80707d1734
commit
497423ddc2
|
@ -116,13 +116,17 @@ def get_configuration(server, system_args):
|
||||||
cfg_file_path = os.path.normpath(os.path.expanduser(
|
cfg_file_path = os.path.normpath(os.path.expanduser(
|
||||||
system_args.configfile))
|
system_args.configfile))
|
||||||
if not os.path.isfile(cfg_file_path):
|
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)
|
config = configparser.ConfigParser(interpolation=None)
|
||||||
try:
|
try:
|
||||||
config.read(cfg_file_path)
|
config.read(cfg_file_path)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
raise ConfigError(f"Error Reading Config: '{cfg_file_path}'") from None
|
raise ConfigError(f"Error Reading Config: '{cfg_file_path}'") from e
|
||||||
|
|
||||||
try:
|
try:
|
||||||
server_cfg = config['server']
|
server_cfg = config['server']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
Loading…
Reference in New Issue