From 5a8bb9eee91a8d058021e62c3dd19358c3b39136 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Wed, 18 Oct 2023 11:19:27 +0200 Subject: [PATCH] conf: handle invalid syntax in rust2rpm.toml more gracefully --- rust2rpm/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust2rpm/conf.py b/rust2rpm/conf.py index 50c782c..0f22493 100644 --- a/rust2rpm/conf.py +++ b/rust2rpm/conf.py @@ -530,6 +530,11 @@ def load_config(features: set[str], target: str) -> TomlConf: except FileNotFoundError as exc: tomlconf = None + except tomllib.TOMLDecodeError as exc: + log.error("Cannot read rust2rpm.toml file (TOML syntax error):") + log.error(str(exc)) + sys.exit(1) + except jsonschema.ValidationError as exc: if not exc.path: log.error("Invalid rust2rpm.toml file (unknown setting or table):")