Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat: merge identical url from different error messages (#1572)

Shimada66630de484d49c9
diff --git a/opendevin/const/guide_url.py b/opendevin/const/guide_url.py
new file mode 100644
index 0000000000..80bb3cfa98
--- /dev/null
+++ b/opendevin/const/guide_url.py
@@ -0,0 +1 @@
+TROUBLESHOOTING_URL = 'https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting'
diff --git a/opendevin/runtime/docker/exec_box.py b/opendevin/runtime/docker/exec_box.py
index 9c4e325fb3..a65ef5ccff 100644
--- a/opendevin/runtime/docker/exec_box.py
+++ b/opendevin/runtime/docker/exec_box.py
@@ -11,6 +11,7 @@ from typing import Dict, List, Tuple
import docker
+from opendevin.const.guide_url import TROUBLESHOOTING_URL
from opendevin.core import config
from opendevin.core.exceptions import SandboxInvalidBackgroundCommandError
from opendevin.core.logger import opendevin_logger as logger
@@ -56,7 +57,7 @@ class DockerExecBox(Sandbox):
self.docker_client = docker.from_env()
except Exception as ex:
logger.exception(
- 'Error creating controller. Please check Docker is running and visit `https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting` for more debugging information.',
+ f'Error creating controller. Please check Docker is running and visit `{TROUBLESHOOTING_URL}` for more debugging information.',
exc_info=False,
)
raise ex
diff --git a/opendevin/runtime/docker/ssh_box.py b/opendevin/runtime/docker/ssh_box.py
index 9d1b8eec7f..f5f798eff7 100644
--- a/opendevin/runtime/docker/ssh_box.py
+++ b/opendevin/runtime/docker/ssh_box.py
@@ -11,6 +11,7 @@ from typing import Dict, List, Tuple, Union
import docker
from pexpect import pxssh
+from opendevin.const.guide_url import TROUBLESHOOTING_URL
from opendevin.core import config
from opendevin.core.exceptions import SandboxInvalidBackgroundCommandError
from opendevin.core.logger import opendevin_logger as logger
@@ -72,7 +73,7 @@ class DockerSSHBox(Sandbox):
self.docker_client = docker.from_env()
except Exception as ex:
logger.exception(
- 'Error creating controller. Please check Docker is running and visit `https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting` for more debugging information.',
+ f'Error creating controller. Please check Docker is running and visit `{TROUBLESHOOTING_URL}` for more debugging information.',
exc_info=False,
)
raise ex
diff --git a/opendevin/server/agent/agent.py b/opendevin/server/agent/agent.py
index d24de297a8..6d5f2a0f6c 100644
--- a/opendevin/server/agent/agent.py
+++ b/opendevin/server/agent/agent.py
@@ -1,6 +1,7 @@
import asyncio
from typing import Dict, List, Optional
+from opendevin.const.guide_url import TROUBLESHOOTING_URL
from opendevin.controller import AgentController
from opendevin.controller.agent import Agent
from opendevin.core import config
@@ -166,7 +167,7 @@ class AgentUnit:
except Exception as e:
logger.exception(f'Error creating controller: {e}')
await self.send_error(
- 'Error creating controller. Please check Docker is running and visit `https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting` for more debugging information..'
+ f'Error creating controller. Please check Docker is running and visit `{TROUBLESHOOTING_URL}` for more debugging information..'
)
return
await self.init_done()