Is there a common design pattern for fatal exit?
When writing a node, is there a common idiom or design pattern for handling a fatal error, exiting, and cleaning up?
Should I just do something like:
if ( something_bad_happened() ) {
ROS_FATAL("Something bad happened.");
exit(1);
}
Does ROS install an atexit()
handler to clean up gracefully in this situation?
Or is it generally bad practice to call exit()
from within a node?
--wpd
I found this link in the ROS C++ Style Guide. Technically, it doesn't say "Only call
exit()
at a single well-defined exit point for the application." so I guess this fits within the style guide, but I still wonder what others do.