From 0eafff5c03de7ccf74053b35d118cf768eef59c0 Mon Sep 17 00:00:00 2001 From: iwatkot Date: Mon, 17 Feb 2025 16:05:00 +0100 Subject: [PATCH] Raise errors if can't find schema. --- webui/config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webui/config.py b/webui/config.py index b812d28..089a676 100644 --- a/webui/config.py +++ b/webui/config.py @@ -62,6 +62,10 @@ def get_schema(game_code: str, schema_type: Literal["texture", "tree"]) -> list[ list[dict[str, Any]]: The schema for the specified game and schema type. """ schema_path = os.path.join(DATA_DIRECTORY, f"{game_code}-{schema_type}-schema.json") + + if not os.path.isfile(schema_path): + raise FileNotFoundError(f"{schema_type} for {game_code} not found in {schema_path}.") + with open(schema_path, "r", encoding="utf-8") as f: schema = json.load(f) return schema