From 8e9aa0cdd3edb94bb67673f2db472de44a70318f Mon Sep 17 00:00:00 2001 From: Chris Smit Date: Thu, 19 Dec 2024 15:05:45 +0200 Subject: [PATCH] Give the bot info about what went wrong --- apps/chat/agent/openapi_tool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/chat/agent/openapi_tool.py b/apps/chat/agent/openapi_tool.py index f513afdb8..fc02e7a36 100644 --- a/apps/chat/agent/openapi_tool.py +++ b/apps/chat/agent/openapi_tool.py @@ -90,8 +90,8 @@ def call_api(self, **kwargs) -> Any: try: return self.auth_service.call_with_retries(self._make_request, client, url, method, **kwargs) except httpx.HTTPStatusError as e: - # if e.response and e.response.status_code == 400: - # return {"error": "Bad Request", "details": e.response.text} + if e.response and e.response.status_code == 400: + raise ToolException(f"Bad request: {e.response.text}") raise ToolException(f"Error making request: {str(e)}") except httpx.HTTPError as e: raise ToolException(f"Error making request: {str(e)}")