From b9627c8d6d8cb0f204c6f60d75cfa226451e62b9 Mon Sep 17 00:00:00 2001 From: subframe7536 <1667077010@qq.com> Date: Sat, 22 Feb 2025 20:12:46 +0800 Subject: [PATCH] error handle for config file --- build.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index c6640af..7bad1fd 100755 --- a/build.py +++ b/build.py @@ -313,8 +313,14 @@ class FontConfig: else {**getattr(self, prop), **val}, ) - except (): - print("Fail to load config.json. Please check your config.json.") + except FileNotFoundError: + print(f"🚨 Config file not found: {config_file_path}, use default config") + pass + except json.JSONDecodeError: + print(f"❗ Error: Invalid JSON in config file: {config_file_path}") + exit(1) + except Exception as e: # Catch any other unexpected error + print(f"❗ An unexpected error occurred: {e}") exit(1) def __load_args(self, args):