Skip to content

Commit

Permalink
Clear out errors once we have handled them. (#701)
Browse files Browse the repository at this point in the history
In particular, in the type-hash code we can handle a
failure to encode or parse the type hash from the user
data.  Once we've handled it, and printed out an error
about it, we should clear it because we are going to
continue on and something else down the line might
have an error.

This will avoid errors like:

This error state is being overwritten:

 <old message>

with this new error message:

 <new message>

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Jul 28, 2023
1 parent 934f403 commit b45e735
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ class ParticipantListener : public eprosima::fastdds::dds::DomainParticipantList
reinterpret_cast<const char *>(userDataValue.data()));
*/
type_hash = rosidl_get_zero_initialized_type_hash();
// We've handled the error, so clear it out.
rmw_reset_error();
}

context->graph_cache.add_entity(
Expand Down
3 changes: 3 additions & 0 deletions rmw_fastrtps_shared_cpp/src/qos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ fill_data_entity_qos_from_profile(
"rmw_fastrtps_shared_cpp",
"Failed to encode type hash for topic, will not distribute it in USER_DATA.");
user_data_str.clear();
// Since we are going to go on without a hash, we clear the error so other
// code won't overwrite it.
rmw_reset_error();
}
std::vector<uint8_t> user_data(user_data_str.begin(), user_data_str.end());
entity_qos.user_data().resize(user_data.size());
Expand Down

0 comments on commit b45e735

Please sign in to comment.