Skip to content

Commit 49bb198

Browse files
committed
[commands] Clarified error messages for parallel composition commands (#6353)
1 parent 125788e commit 49bb198

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

commands2/parallelcommandgroup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ def addCommands(self, *commands: Command):
4949
for command in commands:
5050
in_common = command.getRequirements().intersection(self.requirements)
5151
if in_common:
52+
requirements_str = ", ".join([s.getName() for s in command.getRequirements()])
5253
raise IllegalCommandUse(
53-
"Multiple commands in a parallel composition cannot require the same subsystems.",
54+
f"Command {command.getName()} could not be added to this ParallelCommandGroup"
55+
f" because the subsystems [{requirements_str}] are already required in this command."
56+
f" Multiple commands in a parallel composition cannot require the same subsystems.",
5457
common=in_common,
5558
)
5659

commands2/paralleldeadlinegroup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,11 @@ def addCommands(self, *commands: Command):
8585
for command in commands:
8686
in_common = command.getRequirements().intersection(self.requirements)
8787
if in_common:
88+
requirements_str = ", ".join([s.getName() for s in command.getRequirements()])
8889
raise IllegalCommandUse(
89-
"Multiple commands in a parallel composition cannot require the same subsystems.",
90+
f"Command {command.getName()} could not be added to this ParallelCommandGroup"
91+
f" because the subsystems [{requirements_str}] are already required in this command."
92+
f" Multiple commands in a parallel composition cannot require the same subsystems.",
9093
common=in_common,
9194
)
9295

commands2/parallelracegroup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ def addCommands(self, *commands: Command):
5151
for command in commands:
5252
in_common = command.getRequirements().intersection(self.requirements)
5353
if in_common:
54+
requirements_str = ", ".join([s.getName() for s in command.getRequirements()])
5455
raise IllegalCommandUse(
55-
"Multiple commands in a parallel composition cannot require the same subsystems.",
56+
f"Command {command.getName()} could not be added to this ParallelCommandGroup"
57+
f" because the subsystems [{requirements_str}] are already required in this command."
58+
f" Multiple commands in a parallel composition cannot require the same subsystems.",
5659
common=in_common,
5760
)
5861

0 commit comments

Comments
 (0)