Skip to content

Commit b45e735

Browse files
authored
Clear out errors once we have handled them. (#701)
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]>
1 parent 934f403 commit b45e735

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_participant_info.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ class ParticipantListener : public eprosima::fastdds::dds::DomainParticipantList
228228
reinterpret_cast<const char *>(userDataValue.data()));
229229
*/
230230
type_hash = rosidl_get_zero_initialized_type_hash();
231+
// We've handled the error, so clear it out.
232+
rmw_reset_error();
231233
}
232234

233235
context->graph_cache.add_entity(

rmw_fastrtps_shared_cpp/src/qos.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ fill_data_entity_qos_from_profile(
165165
"rmw_fastrtps_shared_cpp",
166166
"Failed to encode type hash for topic, will not distribute it in USER_DATA.");
167167
user_data_str.clear();
168+
// Since we are going to go on without a hash, we clear the error so other
169+
// code won't overwrite it.
170+
rmw_reset_error();
168171
}
169172
std::vector<uint8_t> user_data(user_data_str.begin(), user_data_str.end());
170173
entity_qos.user_data().resize(user_data.size());

0 commit comments

Comments
 (0)