Skip to content

Commit

Permalink
Fatal error when a mandatory key is missing from the config; no more …
Browse files Browse the repository at this point in the history
…print when a checker is not explicitly disabled in the config
  • Loading branch information
JasperCraeghs committed Nov 29, 2024
1 parent a356885 commit 61bfc61
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/mlx/warnings/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ def config_parser(self, config):
'''
# activate checker
for checker in self.public_checkers:
try:
if checker.name in config:
checker_config = config[checker.name]
if bool(checker_config['enabled']):
self.activate_checker(checker)
checker.parse_config(checker_config)
print("Config parsing for {name} completed".format(name=checker.name))
except KeyError as err:
print("Incomplete config. Missing: {key}".format(key=err))
try:
if bool(checker_config['enabled']):
self.activate_checker(checker)
checker.parse_config(checker_config)
print("Config parsing for {name} completed".format(name=checker.name))
except KeyError as err:
raise WarningsConfigError(f"Incomplete config. Missing: {err}") from err

def write_counted_warnings(self, out_file):
''' Writes counted warnings to the given file
Expand Down

0 comments on commit 61bfc61

Please sign in to comment.