use new rmw_get_error_string_safe func

This commit is contained in:
William Woodall 2015-06-30 11:54:40 -07:00
parent 397cde7ee9
commit 2d5afac3a6
6 changed files with 12 additions and 12 deletions

View file

@ -59,7 +59,7 @@ public:
if (rmw_destroy_client(client_handle_) == RMW_RET_ERROR) {
// *INDENT-OFF*
std::cerr << "Error in destruction of rmw client handle: "
<< (rmw_get_error_string() ? rmw_get_error_string() : "")
<< rmw_get_error_string_safe()
<< std::endl;
// *INDENT-ON*
}

View file

@ -52,7 +52,7 @@ Node::Node(std::string node_name, context::Context::SharedPtr context)
if (ret != RMW_RET_OK) {
// *INDENT-OFF*
std::cerr << "Error in destruction of rmw node handle: "
<< (rmw_get_error_string() ? rmw_get_error_string() : "")
<< rmw_get_error_string_safe()
<< std::endl;
// *INDENT-ON*
}
@ -62,7 +62,7 @@ Node::Node(std::string node_name, context::Context::SharedPtr context)
// *INDENT-OFF*
throw std::runtime_error(
std::string("could not create node: ") +
(rmw_get_error_string() ? rmw_get_error_string() : ""));
rmw_get_error_string_safe());
// *INDENT-ON*
}
@ -97,7 +97,7 @@ Node::create_publisher(std::string topic_name, size_t queue_size)
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
throw std::runtime_error(
std::string("could not create publisher: ") +
(rmw_get_error_string() ? rmw_get_error_string() : ""));
rmw_get_error_string_safe());
// *INDENT-ON*
}
@ -135,7 +135,7 @@ Node::create_subscription(
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
throw std::runtime_error(
std::string("could not create subscription: ") +
(rmw_get_error_string() ? rmw_get_error_string() : ""));
rmw_get_error_string_safe());
// *INDENT-ON*
}
@ -209,7 +209,7 @@ Node::create_client(
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
throw std::runtime_error(
std::string("could not create client: ") +
(rmw_get_error_string() ? rmw_get_error_string() : ""));
rmw_get_error_string_safe());
// *INDENT-ON*
}
@ -252,7 +252,7 @@ Node::create_service(
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
throw std::runtime_error(
std::string("could not create service: ") +
(rmw_get_error_string() ? rmw_get_error_string() : ""));
rmw_get_error_string_safe());
// *INDENT-ON*
}

View file

@ -50,7 +50,7 @@ public:
if (rmw_destroy_publisher(node_handle_.get(), publisher_handle_) == RMW_RET_ERROR) {
// *INDENT-OFF*
std::cerr << "Error in destruction of rmw publisher handle: "
<< (rmw_get_error_string() ? rmw_get_error_string() : "")
<< rmw_get_error_string_safe()
<< std::endl;
// *INDENT-ON*
}

View file

@ -57,7 +57,7 @@ public:
if (service_handle_) {
if (rmw_destroy_service(service_handle_) == RMW_RET_ERROR) {
std::cerr << "Error in destruction of rmw service_handle_ handle: " <<
(rmw_get_error_string() ? rmw_get_error_string() : "") <<
rmw_get_error_string_safe() <<
std::endl;
}
}

View file

@ -63,7 +63,7 @@ public:
if (subscription_handle_) {
if (rmw_destroy_subscription(node_handle_.get(), subscription_handle_) == RMW_RET_ERROR) {
std::cerr << "Error in destruction of rmw subscription handle: " <<
(rmw_get_error_string() ? rmw_get_error_string() : "") <<
rmw_get_error_string_safe() <<
std::endl;
}
}

View file

@ -58,7 +58,7 @@ public:
// TODO(wjwwood): use custom exception
throw std::runtime_error(
std::string("failed to create guard condition: ") +
(rmw_get_error_string() ? rmw_get_error_string() : "")
rmw_get_error_string_safe()
);
}
}
@ -68,7 +68,7 @@ public:
if (guard_condition_) {
if (rmw_destroy_guard_condition(guard_condition_) == RMW_RET_ERROR) {
std::cerr << "Error in TimerBase destructor, rmw_destroy_guard_condition failed: " <<
(rmw_get_error_string() ? rmw_get_error_string() : "") <<
rmw_get_error_string_safe() <<
std::endl;
}
}