From 753714b639588e2a8185646fd82a03adccbec702 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 13 Aug 2023 18:16:33 +0100 Subject: [PATCH] should the loader attempt to load an invalid toml config log as error but allow the loader to continue --- vban_cmd/config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vban_cmd/config.py b/vban_cmd/config.py index 7d24a56..0cfe2d0 100644 --- a/vban_cmd/config.py +++ b/vban_cmd/config.py @@ -148,8 +148,13 @@ class Loader(metaclass=SingletonType): self.logger.info( f"config file with name {identifier} already in memory, skipping.." ) - return False - self.parser = dataextraction_factory(data) + return + try: + self.parser = dataextraction_factory(data) + except tomllib.TOMLDecodeError as e: + ERR_MSG = (str(e), f"When attempting to load {identifier}.toml") + self.logger.error(f"{type(e).__name__}: {' '.join(ERR_MSG)}") + return return True def register(self, identifier, data=None):