mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 22:17:35 +00:00
Handle TimeoutError in tool execution
This commit is contained in:
1 parent
04c9a680ea
commit
854bb97710
1 file changed
+8
-2
@@ -286,8 +286,14 @@ class Tool(Component):
|
||||
|
||||
return result
|
||||
|
||||
future = self.agent.issue_task(task, name=self.__class__.__name__)
|
||||
return future.result(timeout=self.agent.serena_config.tool_timeout)
|
||||
# execute the tool in the agent's task executor, with timeout
|
||||
try:
|
||||
task_exec = self.agent.issue_task(task, name=self.__class__.__name__)
|
||||
return task_exec.result(timeout=self.agent.serena_config.tool_timeout)
|
||||
except Exception as e: # typically TimeoutError (other exceptions caught in task)
|
||||
msg = f"Error: {e.__class__.__name__} - {e}"
|
||||
log.error(msg)
|
||||
return msg
|
||||
|
||||
|
||||
class EditedFileContext:
|
||||
|
||||
Reference in new issue
Block a user