log error message instead of throwing exception in destructor (#535)

This commit is contained in:
Karsten Knese 2018-08-17 10:17:37 -07:00 committed by GitHub
parent e409e44413
commit 45d74ba4dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,8 @@
#include "rclcpp/macros.hpp" #include "rclcpp/macros.hpp"
#include "rclcpp/visibility_control.hpp" #include "rclcpp/visibility_control.hpp"
#include "rcutils/logging_macros.h"
#include "rmw/serialized_message.h" #include "rmw/serialized_message.h"
namespace rclcpp namespace rclcpp
@ -96,7 +98,9 @@ public:
auto ret = rmw_serialized_message_fini(msg); auto ret = rmw_serialized_message_fini(msg);
delete msg; delete msg;
if (ret != RCL_RET_OK) { if (ret != RCL_RET_OK) {
rclcpp::exceptions::throw_from_rcl_error(ret, "leaking memory"); RCUTILS_LOG_ERROR_NAMED(
"rclcpp",
"failed to destroy serialized message: %s", rcl_get_error_string_safe());
} }
}); });