mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
add error handling for action running (#212)
This commit is contained in:
@@ -101,7 +101,12 @@ class AgentController:
|
||||
action = action_cls(**_kwargs)
|
||||
print(action, flush=True)
|
||||
if action.executable:
|
||||
observation = action.run(self)
|
||||
try:
|
||||
observation = action.run(self)
|
||||
except Exception as e:
|
||||
observation = AgentErrorObservation(str(e))
|
||||
print_with_indent("\nACTION RUN ERROR:\n%s" % observation)
|
||||
traceback.print_exc()
|
||||
|
||||
if not isinstance(observation, NullObservation):
|
||||
print_with_indent("\nOBSERVATION:\n%s" % observation)
|
||||
|
||||
Reference in New Issue
Block a user