Skip to content

Commit 8672ad8

Browse files
committed
Handle exceptions from running llm command and surface them appropriately.
1 parent b8b65c8 commit 8672ad8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • litecli/packages/special

litecli/packages/special/llm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def run_external_cmd(cmd, *args, capture_output=False, restart_cli=False, raise_
4848
except SystemExit as e:
4949
code = e.code
5050
if code != 0 and raise_exception:
51-
raise
51+
if capture_output:
52+
raise RuntimeError(buffer.getvalue())
53+
else:
54+
raise RuntimeError(f"Command {cmd} failed with exit code {code}.")
5255

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

0 commit comments

Comments
 (0)