Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions launch/launch/actions/include_launch_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import Iterable, Sequence
from typing import List
from typing import Optional
from typing import Text
from typing import Tuple
from typing import Union

Expand Down Expand Up @@ -160,8 +161,13 @@ def execute(self, context: LaunchContext) -> List[LaunchDescriptionEntity]:
perform_substitutions(context, normalize_to_list_of_substitutions(arg_name))
for arg_name, arg_value in self.launch_arguments
]
declared_launch_arguments = (
launch_description.get_launch_arguments_with_include_launch_description_actions())
try:
declared_launch_arguments = (
launch_description.get_launch_arguments_with_include_launch_description_actions())
except Exception as exc:
if hasattr(exc, 'add_note'):
exc.add_note(f'while executing {self.describe()}')
Comment thread
rolker marked this conversation as resolved.
Outdated
raise
for argument, ild_actions in declared_launch_arguments:
if argument._conditionally_included or argument.default_value is not None:
continue
Expand All @@ -183,3 +189,7 @@ def execute(self, context: LaunchContext) -> List[LaunchDescriptionEntity]:

# Set launch arguments as launch configurations and then include the launch description.
return [*set_launch_configuration_actions, launch_description]

def __repr__(self) -> Text:
"""Return a description of this IncludeLaunchDescription as a string."""
return f'IncludeLaunchDescription({self.__launch_description_source.location})'
13 changes: 9 additions & 4 deletions launch/launch/launch_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,15 @@ def process_entities(entities, *, _conditional_inclusion, nested_ild_actions=Non
if next_nested_ild_actions is None:
next_nested_ild_actions = []
next_nested_ild_actions.append(entity)
process_entities(
entity.describe_sub_entities(),
_conditional_inclusion=False,
nested_ild_actions=next_nested_ild_actions)
try:
process_entities(
entity.describe_sub_entities(),
_conditional_inclusion=False,
nested_ild_actions=next_nested_ild_actions)
except Exception as e:
if hasattr(e, 'add_note'):
e.add_note(f'processing sub-entities of entity: {entity}')
raise
for conditional_sub_entity in entity.describe_conditional_sub_entities():
process_entities(
conditional_sub_entity[1],
Expand Down
2 changes: 1 addition & 1 deletion launch/launch/substitutions/path_join_substitution.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def substitutions(self) -> Iterable[Substitution]:
"""Getter for variable_name."""
return self.__substitutions

def describe(self) -> Text:
def __repr__(self) -> Text:
"""Return a description of this substitution as a string."""
return f"PathJoin('{' + '.join([s.describe() for s in self.substitutions])}')"

Expand Down