Catch all exceptions in autogpt (#3413)

Ought to be more autonomous
This commit is contained in:
Zander Chase 2023-04-23 20:02:37 -07:00 committed by GitHub
parent 738ee56b86
commit 3d8243ec95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,13 @@ class AutoGPT:
try:
observation = tool.run(action.args)
except ValidationError as e:
observation = f"Error in args: {str(e)}"
observation = (
f"Validation Error in args: {str(e)}, args: {action.args}"
)
except Exception as e:
observation = (
f"Error: {str(e)}, {type(e).__name__}, args: {action.args}"
)
result = f"Command {tool.name} returned: {observation}"
elif action.name == "ERROR":
result = f"Error: {action.args}. "