Skip to content

Commit

Permalink
Catch throw from clock now method
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Ezequiel Marchi <brian.marchi65@gmail.com>
  • Loading branch information
BMarchi committed Oct 15, 2019
1 parent 6216931 commit b61c5c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rclcpp/resource/logging.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ def is_supported_feature_combination(feature_combination):
typename ::rclcpp::Logger>::value, \
"First argument to logging macros must be an rclcpp::Logger"); \
@[ if 'throttle' in feature_combination]@ \
std::function<rcutils_ret_t (rcutils_time_point_value_t *)> get_time_point = [&clock](rcutils_time_point_value_t * time_point) -> rcutils_ret_t { \
auto get_time_point = [&clock](rcutils_time_point_value_t * time_point) -> rcutils_ret_t { \
try { \
*time_point = clock.now().nanoseconds(); \
return RCUTILS_RET_OK; \
}; \
} catch (...) { \
return RCUTILS_RET_ERROR; \
} \
return RCUTILS_RET_OK; \
}; \
@[ end if] \
RCUTILS_LOG_@(severity)@(suffix)_NAMED( \
@{params = ['get_time_point' if p == 'clock' and 'throttle' in feature_combination else p for p in params]}@
Expand Down

0 comments on commit b61c5c8

Please sign in to comment.