From 0fe59515ca48f0e59508e4d46b40713626abcbaf Mon Sep 17 00:00:00 2001 From: Harry <164126595+wwyharry@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:17:37 +0800 Subject: [PATCH] Improve error handling for tool argument parsing Fixed the bare `except` issue (JSONDecodeError, ValueError, TypeError) --- openspace/llm/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openspace/llm/client.py b/openspace/llm/client.py index 19a1664..032f2a9 100644 --- a/openspace/llm/client.py +++ b/openspace/llm/client.py @@ -650,8 +650,8 @@ class LLMClient: args_str = json.dumps(args, ensure_ascii=False)[:200] self._logger.info(f"Calling {tool_name} with args: {args_str}") - except: - pass + except (json.JSONDecodeError, ValueError, TypeError) as e: + self._logger.debug(f"Failed to parse tool arguments for {tool_name}: {e}") if tool_name not in tool_map: result = ToolResult( @@ -766,4 +766,4 @@ class LLMClient: role = msg.get("role", "unknown").upper() content = msg.get("content", "") formatted += f"[{role}]\n{content}\n\n" - return formatted \ No newline at end of file + return formatted