mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Show relevant error in UI (#2516)
This commit is contained in:
parent
92a1eaa866
commit
d0bdae232f
@ -120,9 +120,9 @@ class AgentController:
|
||||
- the string message should be user-friendly, it will be shown in the UI
|
||||
- an ErrorObservation can be sent to the LLM by the agent, with the exception message, so it can self-correct next time
|
||||
"""
|
||||
self.state.error = message
|
||||
if exception:
|
||||
self.state.error += f': {str(exception)}'
|
||||
message += f': {exception}'
|
||||
self.state.error = message
|
||||
await self.event_stream.add_event(ErrorObservation(message), EventSource.AGENT)
|
||||
|
||||
async def add_history(self, action: Action, observation: Observation):
|
||||
@ -140,7 +140,6 @@ class AgentController:
|
||||
logger.info('AgentController task was cancelled')
|
||||
break
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
logger.error(f'Error while running the agent: {e}')
|
||||
logger.error(traceback.format_exc())
|
||||
await self.report_error(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user