Task #4836
openThrowing exception in ProducerBase::onRegisterFailed has no effect
0%
Description
The method ProducerBase::onRegisterFailed throws an exception:
https://github.com/named-data/PSync/blob/0cf4b600e91455ee07c38eb22876aa6b653bc14b/PSync/producer-base.cpp#L147
NDN_LOG_ERROR("ProduerBase::onRegisterFailed " << prefix << " " << msg);
BOOST_THROW_EXCEPTION(Error(msg));
But onRegisterFailed is called from a library callback which handles a timeout or receives an error packet for the registration request. Then library will not pass the exception to the application, so throwing the exception in onRegisterFailed has no effect. PSync already logs the exception, which is the correct behavior. The code to throw the exception can be removed.
This is a low priority comment. Feel free to ignore.
Updated by Anonymous almost 6 years ago
... throwing the exception should have no effect, except that the unit test MultipleNodesSimulataneousPublish fails if the code that throws the exception is removed:
https://github.com/named-data/PSync/blob/0cf4b600e91455ee07c38eb22876aa6b653bc14b/tests/test-full-sync.cpp#L189
I'll repeat my claim that it does not make sense for a callback which is invoked by the system to try to communicate to the application by throwing an exception.