ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Partially reproducing what I've written elsewhere, rcutils
error handling is somewhat similar to POSIX errno based error handling. There's a global error state, that in this case is populated with an arbitrary string, and functions let calling code know there was an error in some way -- often using a well-known numeric return code, but sometimes it may be something else. From then on, it is up to calling code to decide on what should be done with that (string) error state.
Thus,
*_SET_ERROR_MSG
macros are not conditionally-compilable print or logging macros. They set an error state. Where, when, how and even if that error state is eventually made visible is entirely up to client code up in the stack. RCUTILS_REPORT_ERROR_HANDLING_ERRORS
purpose is not to turn some of these macros into prints, but to avoid masking errors by printing the error state that is about to be overwritten in the hypothetical case in which client code does poor error handling (i.e. it reports errors with error handling itself).
Question is based on an invalid assumption/expectation.
Hope this clarifies things a bit.