From 5eb0e406fdc6e0612db18ea5bde93f98c215808d Mon Sep 17 00:00:00 2001 From: Zach White Date: Mon, 9 Aug 2021 08:27:02 -0700 Subject: make json imports more robust (#13928) --- lib/python/qmk/json_schema.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/python/qmk') diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py index 077dfcaa93..f3992ee71a 100644 --- a/lib/python/qmk/json_schema.py +++ b/lib/python/qmk/json_schema.py @@ -17,9 +17,12 @@ def json_load(json_file): try: return hjson.load(json_file.open(encoding='utf-8')) - except json.decoder.JSONDecodeError as e: + except (json.decoder.JSONDecodeError, hjson.HjsonDecodeError) as e: cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) exit(1) + except Exception as e: + cli.log.error('Unknown error attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) + exit(1) def load_jsonschema(schema_name): -- cgit v1.2.3 From e6c171bdd639fef41a68902ce5a379a0565ed99b Mon Sep 17 00:00:00 2001 From: Zach White Date: Mon, 9 Aug 2021 08:28:51 -0700 Subject: Fix generate api (#13930) * Add missing returncode to exit() * fix the aozora/hotswap vendor id --- lib/python/qmk/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python/qmk') diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 47c8bff7a8..d23b3592ee 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -71,7 +71,7 @@ def info_json(keyboard): except jsonschema.ValidationError as e: json_path = '.'.join([str(p) for p in e.absolute_path]) cli.log.error('Invalid API data: %s: %s: %s', keyboard, json_path, e.message) - exit() + exit(1) # Make sure we have at least one layout if not info_data.get('layouts'): -- cgit v1.2.3