From 36d5f2a53211d440539efbf8b1b322adefe2e9fa Mon Sep 17 00:00:00 2001 From: aeon0 Date: Sat, 1 Jan 2022 20:24:16 +0100 Subject: [PATCH] Catch pickit config errors and reduce to print (#372) --- src/config.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config.py b/src/config.py index ee64da7..b442cae 100644 --- a/src/config.py +++ b/src/config.py @@ -165,9 +165,13 @@ class Config: self.items = {} for key in self._pickit_config["items"]: - self.items[key] = self.parse_item_config_string(key) - if self.items[key].pickit_type and not os.path.exists(f"./assets/items/{key}.png") and self._print_warnings: - print(f"Warning: You activated {key} in pickit, but there is no img available in assets/items") + try: + self.items[key] = self.parse_item_config_string(key) + if self.items[key].pickit_type and not os.path.exists(f"./assets/items/{key}.png") and self._print_warnings: + print(f"Warning: You activated {key} in pickit, but there is no img available in assets/items") + except ValueError as e: + if self._print_warnings: + print(f"Error with pickit config: {key} ({e})") self.colors = {} for key in self._game_config["colors"]: