Skip to content

Commit

Permalink
Handle exceptions from running llm command and surface them appropr…
Browse files Browse the repository at this point in the history
…iately.
  • Loading branch information
amjith committed Jan 26, 2025
1 parent b8b65c8 commit 8672ad8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion litecli/packages/special/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def run_external_cmd(cmd, *args, capture_output=False, restart_cli=False, raise_
except SystemExit as e:
code = e.code
if code != 0 and raise_exception:
raise
if capture_output:
raise RuntimeError(buffer.getvalue())
else:
raise RuntimeError(f"Command {cmd} failed with exit code {code}.")

if restart_cli and code == 0:
os.execv(original_exe, [original_exe] + original_args)
Expand Down

0 comments on commit 8672ad8

Please sign in to comment.