fix: set _last_execution_errored in add_image exception handlers

Address Cursor Bugbot review: the add_image exception handlers in
use() and ause() were missing the error flag, allowing result_as_answer
to be incorrectly honored when those paths errored.

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2026-03-28 16:55:16 +00:00
parent 99066ca278
commit f5dc745669

View File

@@ -158,6 +158,7 @@ class ToolUsage:
except Exception as e:
error = getattr(e, "message", str(e))
self._last_execution_errored = True
if self.task:
self.task.increment_tools_errors()
if self.agent and self.agent.verbose:
@@ -210,6 +211,7 @@ class ToolUsage:
)
except Exception as e:
error = getattr(e, "message", str(e))
self._last_execution_errored = True
if self.task:
self.task.increment_tools_errors()
if self.agent and self.agent.verbose: