use throw_from_rcl_error() for error state cleanup (#376)
This commit is contained in:
parent
ca5fb57126
commit
5813ba54db
1 changed files with 3 additions and 4 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "rcl/allocator.h"
|
||||
#include "rcl/error_handling.h"
|
||||
|
||||
#include "rclcpp/exceptions.hpp"
|
||||
#include "rclcpp/executor.hpp"
|
||||
#include "rclcpp/node.hpp"
|
||||
#include "rclcpp/scope_exit.hpp"
|
||||
|
@ -418,10 +419,8 @@ Executor::wait_for_work(std::chrono::nanoseconds timeout)
|
|||
if (status == RCL_RET_WAIT_SET_EMPTY) {
|
||||
fprintf(stderr, "Warning: empty waitset received in rcl_wait(). This should never happen.\n");
|
||||
} else if (status != RCL_RET_OK && status != RCL_RET_TIMEOUT) {
|
||||
std::string msg = "rcl_wait() failed: ";
|
||||
msg += rcl_get_error_string_safe();
|
||||
rcl_reset_error();
|
||||
throw std::runtime_error(msg);
|
||||
using rclcpp::exceptions::throw_from_rcl_error;
|
||||
throw_from_rcl_error(status, "rcl_wait() failed");
|
||||
}
|
||||
|
||||
// check the null handles in the waitset and remove them from the handles in memory strategy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue