-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Current implementation calls logger.Fatalf() (and os.Exit() inside) when it's not possible to create objects.
For example:
func (node *defaultNode) NewPublisherWithCallbacks(topic string, msgType MessageType, connectCallback, disconnectCallback func(SingleSubscriberPublisher)) Publisher {
//...
_, err := callRosApi(node.masterUri, "registerPublisher",
node.qualifiedName,
name, msgType.Name(),
node.xmlrpcUri)
if err != nil {
logger.Fatalf("Failed to call registerPublisher(): %s", err)
}
//...
}
The better is to return (Publisher, error) in this case and involve typical Go error handling mechanics than unconditionally die.
I'm building a service where ROS node can be started later, some functionality of it doesn't depend on ROS. But I cannot start when ROS master is not available because of os.Exit() in the rosgo.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels