Enhance exception throwing with Boost Exception library

Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4919aa
Refs: #2541
This commit is contained in:
Spyridon Mastorakis
2015-07-27 13:22:22 -07:00
parent a714792b03
commit 149e02cf7d
36 changed files with 184 additions and 163 deletions
+2 -1
View File
@@ -305,7 +305,8 @@ FibUpdater::onUpdateError(const FibUpdate update,
}
}
else {
throw Error("Non-recoverable error: " + error + " code: " + std::to_string(code));
BOOST_THROW_EXCEPTION(Error("Non-recoverable error: " + error + " code: " +
std::to_string(code)));
}
}
+1 -1
View File
@@ -143,7 +143,7 @@ Nrd::getLocalNfdTransport()
return make_shared<ndn::TcpTransport>("localhost", port);
}
else {
throw Error("No transport is available to communicate with NFD");
BOOST_THROW_EXCEPTION(Error("No transport is available to communicate with NFD"));
}
}
+2 -2
View File
@@ -90,8 +90,8 @@ RemoteRegistrator::loadConfig(const ConfigSection& configSection)
}
else
{
throw ConfigFile::Error("Unrecognized option \"" + i.first +
"\" in \"remote-registrator\" section");
BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option \"" + i.first +
"\" in \"remote-registrator\" section"));
}
}
+3 -3
View File
@@ -167,7 +167,7 @@ RibManager::onConfig(const ConfigSection& configSection,
m_remoteRegistrator.enable();
}
else {
throw Error("Unrecognized rib property: " + item.first);
BOOST_THROW_EXCEPTION(Error("Unrecognized rib property: " + item.first));
}
}
@@ -571,7 +571,7 @@ RibManager::onNrdCommandPrefixAddNextHopSuccess(const Name& prefix,
void
RibManager::onNrdCommandPrefixAddNextHopError(const Name& name, const std::string& msg)
{
throw Error("Error in setting interest filter (" + name.toUri() + "): " + msg);
BOOST_THROW_EXCEPTION(Error("Error in setting interest filter (" + name.toUri() + "): " + msg));
}
void
@@ -586,7 +586,7 @@ RibManager::onControlHeaderError(uint32_t code, const std::string& reason)
std::ostringstream os;
os << "Couldn't enable local control header "
<< "(code: " << code << ", info: " << reason << ")";
throw Error(os.str());
BOOST_THROW_EXCEPTION(Error(os.str()));
}
void