Skip to content

Commit

Permalink
fix: re-raise tool use errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 12, 2024
1 parent 732c5b8 commit 0ada191
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gptme/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def execute(self, ask: bool) -> Generator[Message, None, None]:
try:
yield from tool.execute(self.content, ask, self.args)
except Exception as e:
# if we are testing, raise the exception
if "pytest" in globals():
raise e
yield Message("system", f"Error executing tool '{self.tool}': {e}")
else:
logger.warning(f"Tool '{self.tool}' is not available for execution.")
Expand Down

0 comments on commit 0ada191

Please sign in to comment.