Skip to content

Commit

Permalink
Improve evaluate_paramenter_dict() error msgs
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Gomes de Melo <[email protected]>
  • Loading branch information
FelipeGdM committed Jun 27, 2022
1 parent 88b51d0 commit d3eacdc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions launch_ros/launch_ros/utilities/evaluate_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,20 @@ def check_sequence_type_is_allowed(sequence):
if not check_sequence_type_is_allowed(yaml_evaluated_value):
raise TypeError(
'Expected a non-empty sequence, with items of uniform type. '
'Allowed sequence item types are bool, int, float, str.'
'Allowed sequence item types are bool, int, float, str. '
'Got inconsistent input for "{}"'.format(evaluated_name)
)
evaluated_value = tuple(yaml_evaluated_value)
else:
raise TypeError(
'Allowed value types are bytes, bool, int, float, str, Sequence[bool]'
', Sequence[int], Sequence[float], Sequence[str]. Got {}.'
', Sequence[int], Sequence[float], Sequence[str]. Got {} for "{}". '
'If the parameter is meant to be a string, try wrapping it in '
'launch_ros.parameter_descriptions.ParameterValue'
'(value, value_type=str)'.format(type(yaml_evaluated_value))
'(value, value_type=str)'.format(
type(yaml_evaluated_value),
evaluated_name
)
)
elif isinstance(value[0], Sequence):
# Value is an array of a list of substitutions
Expand All @@ -119,7 +123,8 @@ def check_sequence_type_is_allowed(sequence):
if not check_sequence_type_is_allowed(yaml_evaluated_value):
raise TypeError(
'Expected a non-empty sequence, with items of uniform type. '
'Allowed sequence item types are bool, int, float, str.'
'Allowed sequence item types are bool, int, float, str. '
'Got inconsistent input for "{}"'.format(evaluated_name)
)
evaluated_value = tuple(yaml_evaluated_value)
else:
Expand Down

0 comments on commit d3eacdc

Please sign in to comment.