mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-15 10:41:01 +00:00
Make it easier to debug CLI errors in pytest
Found this pattern while working on #709
This commit is contained in:
parent
64179fa9e0
commit
f95dd55cda
1 changed files with 6 additions and 0 deletions
|
|
@ -450,7 +450,13 @@ def prompt(
|
|||
if extract:
|
||||
text = extract_first_fenced_code_block(text) or text
|
||||
print(text)
|
||||
# List of exceptions that should never be raised in pytest:
|
||||
except (ValueError, NotImplementedError) as ex:
|
||||
raise click.ClickException(str(ex))
|
||||
except Exception as ex:
|
||||
# All other exceptions should raise in pytest, show to user otherwise
|
||||
if getattr(sys, "_called_from_test", False):
|
||||
raise
|
||||
raise click.ClickException(str(ex))
|
||||
|
||||
if isinstance(response, AsyncResponse):
|
||||
|
|
|
|||
Loading…
Reference in a new issue