Skip to content

Commit 549687e

Browse files
committed
Move error messages into runtime errors
1 parent 9d37f8f commit 549687e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

scripts/run_comp_match.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def execute_match(arena_root: Path) -> None:
175175
# Webots is only on the PATH on Linux so we have a helper function to find it
176176
try:
177177
webots, world_file = get_webots_parameters()
178-
except RuntimeError:
179-
raise FileNotFoundError("Webots executable not found.")
178+
except RuntimeError as e:
179+
raise FileNotFoundError(e)
180180

181181
sim_env = os.environ.copy()
182182
sim_env['ARENA_ROOT'] = str(arena_root)

scripts/run_simulator.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def get_webots_parameters() -> tuple[Path, Path]:
4949
raise RuntimeError("World file not found.")
5050

5151
if not (SIM_BASE / "venv").exists():
52-
print("Please run the setup.py script before running the simulator.")
53-
raise RuntimeError
52+
raise RuntimeError("Please run the setup.py script before running the simulator.")
5453

5554
# Check if Webots is in the PATH
5655
webots = which("webots")
@@ -65,8 +64,7 @@ def get_webots_parameters() -> tuple[Path, Path]:
6564
break
6665

6766
if webots is None or not Path(webots).exists():
68-
print("Webots executable not found.")
69-
raise RuntimeError
67+
raise RuntimeError("Webots executable not found.")
7068

7169
return Path(webots), world_file
7270

@@ -87,7 +85,8 @@ def main() -> None:
8785
)
8886
else:
8987
Popen([str(webots), str(world_file)], start_new_session=True)
90-
except RuntimeError:
88+
except RuntimeError as e:
89+
print(f"An error occurred: {e}")
9190
input("Press enter to continue...")
9291
exit(1)
9392
except Exception as e:

0 commit comments

Comments
 (0)