Skip to content

Commit 43f242d

Browse files
committed
fix(debugger): enhance error handling in DAPClient and simplify port allocation for new testrun sessions
- every new test run gets it's own tcp port fixes: #474
1 parent e8297ff commit 43f242d

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/debugger/src/robotcode/debugger/launcher/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ async def wait() -> None:
9696
self._protocol.on_connection_lost.add(self.on_connection_lost)
9797
except (asyncio.CancelledError, KeyboardInterrupt, SystemExit):
9898
raise
99-
except ConnectionError:
99+
except (ConnectionError, OSError):
100100
pass
101+
except BaseException as e:
102+
raise DAPClientError(f"Failed to connect to {self.tcp_params.host}:{self.tcp_params.port}") from e
101103

102104
if self._protocol is not None:
103105
raise DAPClientError("Client already connected.")

packages/debugger/src/robotcode/debugger/launcher/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async def _launch(
136136

137137
connect_timeout = launcherTimeout or 10
138138

139-
port = find_free_port(DEBUGGER_DEFAULT_PORT)
139+
port = find_free_port()
140140

141141
debugger_script = ["-m", "robotcode.cli"] if self.debugger_script is None else [str(Path(self.debugger_script))]
142142

@@ -254,6 +254,7 @@ async def _launch(
254254
),
255255
return_type=RunInTerminalResponseBody,
256256
)
257+
# time.sleep(1) # Give some time for the terminal to start
257258
elif console is None or console == "internalConsole":
258259
run_env: Dict[str, Optional[str]] = dict(os.environ)
259260
run_env.update(env)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[extend-profiles.firefox]
22
description = "The overridden firefox profile"
33
extend-python-path = ["./python"]
4-
output-dir = "output"
4+
#output-dir = "output"
55

66
[tool.robotcode-analyze.extend-modifiers]
77
extend-warning = ["VariableNotFound"]

0 commit comments

Comments
 (0)