[CLI] Don't exit()
when certain exceptions occur. (#23442)
This commit is contained in:
parent
d4654ab893
commit
0262161914
10 changed files with 55 additions and 12 deletions
|
@ -69,7 +69,7 @@ def _via_to_keymap(via_backup, keyboard_data, keymap_layout):
|
|||
layout_data = keyboard_data['layouts'].get(keymap_layout)
|
||||
if not layout_data:
|
||||
cli.log.error(f'LAYOUT macro {keymap_layout} is not a valid one for keyboard {cli.args.keyboard}!')
|
||||
exit(1)
|
||||
return None
|
||||
|
||||
layout_data = layout_data['layout']
|
||||
sorting_hat = list()
|
||||
|
@ -118,7 +118,7 @@ def via2json(cli):
|
|||
keymap_layout = cli.args.layout if cli.args.layout else _find_via_layout_macro(cli.args.keyboard)
|
||||
if not keymap_layout:
|
||||
cli.log.error(f"Couldn't find LAYOUT macro for keyboard {cli.args.keyboard}. Please specify it with the '-l' argument.")
|
||||
exit(1)
|
||||
return False
|
||||
|
||||
# Load the VIA backup json
|
||||
with cli.args.filename.open('r') as fd:
|
||||
|
@ -126,9 +126,15 @@ def via2json(cli):
|
|||
|
||||
# Generate keyboard metadata
|
||||
keyboard_data = info_json(cli.args.keyboard)
|
||||
if not keyboard_data:
|
||||
cli.log.error(f'LAYOUT macro {keymap_layout} is not a valid one for keyboard {cli.args.keyboard}!')
|
||||
return False
|
||||
|
||||
# Get keycode array
|
||||
keymap_data = _via_to_keymap(via_backup, keyboard_data, keymap_layout)
|
||||
if not keymap_data:
|
||||
cli.log.error(f'Could not extract valid keycode data from VIA backup matching keyboard {cli.args.keyboard}!')
|
||||
return False
|
||||
|
||||
# Convert macros
|
||||
macro_data = list()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue