should the loader attempt to load an invalid toml config

log as error but allow the loader to continue
This commit is contained in:
onyx-and-iris 2023-08-13 18:16:33 +01:00
parent 27a26b8fe9
commit 753714b639

View File

@ -148,8 +148,13 @@ class Loader(metaclass=SingletonType):
self.logger.info( self.logger.info(
f"config file with name {identifier} already in memory, skipping.." f"config file with name {identifier} already in memory, skipping.."
) )
return False return
self.parser = dataextraction_factory(data) 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 return True
def register(self, identifier, data=None): def register(self, identifier, data=None):