diff options
author | Zach White <skullydazed@gmail.com> | 2021-08-09 08:27:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 08:27:02 -0700 |
commit | 5eb0e406fdc6e0612db18ea5bde93f98c215808d (patch) | |
tree | c66c1d9ce06b0af49557549a8f40b9afffdd0665 /lib/python/qmk/json_schema.py | |
parent | 79d5b279931cf98d635181235c0301ba7053f9d5 (diff) | |
download | qmk_firmware-5eb0e406fdc6e0612db18ea5bde93f98c215808d.tar.gz qmk_firmware-5eb0e406fdc6e0612db18ea5bde93f98c215808d.zip |
make json imports more robust (#13928)
Diffstat (limited to 'lib/python/qmk/json_schema.py')
-rw-r--r-- | lib/python/qmk/json_schema.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py index 077dfcaa9..f3992ee71 100644 --- a/lib/python/qmk/json_schema.py +++ b/lib/python/qmk/json_schema.py | |||
@@ -17,9 +17,12 @@ def json_load(json_file): | |||
17 | try: | 17 | try: |
18 | return hjson.load(json_file.open(encoding='utf-8')) | 18 | return hjson.load(json_file.open(encoding='utf-8')) |
19 | 19 | ||
20 | except json.decoder.JSONDecodeError as e: | 20 | except (json.decoder.JSONDecodeError, hjson.HjsonDecodeError) as e: |
21 | cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) | 21 | cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) |
22 | exit(1) | 22 | exit(1) |
23 | except Exception as e: | ||
24 | cli.log.error('Unknown error attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) | ||
25 | exit(1) | ||
23 | 26 | ||
24 | 27 | ||
25 | def load_jsonschema(schema_name): | 28 | def load_jsonschema(schema_name): |