Project

General

Profile

Task #4836

Throwing exception in ProducerBase::onRegisterFailed has no effect

Added by Jeff Thompson 3 months ago. Updated 2 months ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
-
Start date:
02/06/2019
Due date:
% Done:

0%

Estimated time:

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.

History

#1 Updated by Jeff Thompson 2 months 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.

Also available in: Atom PDF