π OpenHands: AI-Driven Development
chore: improve error logging for RuntimeError (#6055)
Xingyao Wangf8735efadff0
diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.pyindex 9c5cae6faa..f94b95bb84 100644--- a/openhands/controller/agent_controller.py+++ b/openhands/controller/agent_controller.py@@ -209,10 +209,15 @@ class AgentController:try:await self._step()except Exception as e:- traceback.print_exc()- self.log('error', f'Error while running the agent: {e}')+ self.log(+ 'error',+ f'Error while running the agent (session ID: {self.id}): {e}. '+ f'Traceback: {traceback.format_exc()}',+ )reported = RuntimeError(- 'There was an unexpected error while running the agent.'+ 'There was an unexpected error while running the agent. Please '+ f'report this error to the developers. Your session ID is {self.id}. '+ f'Exception: {e}.')if isinstance(e, litellm.AuthenticationError) or isinstance(e, litellm.BadRequestError