Clarify warning for missing imports

This commit is contained in:
Aymeric 2025-01-06 22:47:13 +01:00
parent c47ea60037
commit 58d25acff5
1 changed files with 2 additions and 2 deletions

View File

@ -965,10 +965,10 @@ class CodeAgent(MultiStepAgent):
f"Error: {str(e)}" f"Error: {str(e)}"
) )
else: else:
error_msg = f"Code execution failed: {str(e)}" error_msg = str(e)
if "Import of " in str(e) and " is not allowed" in str(e): if "Import of " in str(e) and " is not allowed" in str(e):
console.print( console.print(
"[bold red]Code execution failed due to an unauthorized import. Consider passing said import under additional_authorized_imports when initializing your CodeAgent." "[bold red]Warning to user: Code execution failed due to an unauthorized import - Consider passing said import under `additional_authorized_imports` when initializing your CodeAgent."
) )
raise AgentExecutionError(error_msg) raise AgentExecutionError(error_msg)