From b28648c61d8927ee2fc0537ad369eb92ba394253 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Thu, 31 Aug 2017 16:41:05 -0700 Subject: [PATCH] reset error code before throwing in rclcpp::utilities::init --- rclcpp/src/rclcpp/utilities.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rclcpp/src/rclcpp/utilities.cpp b/rclcpp/src/rclcpp/utilities.cpp index 44e41c1..7894407 100644 --- a/rclcpp/src/rclcpp/utilities.cpp +++ b/rclcpp/src/rclcpp/utilities.cpp @@ -163,10 +163,10 @@ rclcpp::utilities::init(int argc, char * argv[]) { g_is_interrupted.store(false); if (rcl_init(argc, argv, rcl_get_default_allocator()) != RCL_RET_OK) { - // *INDENT-OFF* (prevent uncrustify from making unnecessary indents here) - throw std::runtime_error( - std::string("failed to initialize rmw implementation: ") + rcl_get_error_string_safe()); - // *INDENT-ON* + std::string msg = "failed to initialize rmw implementation: "; + msg += rcl_get_error_string_safe(); + rcl_reset_error(); + throw std::runtime_error(msg); } #ifdef HAS_SIGACTION struct sigaction action;