Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4919aa
Refs: #2541
diff --git a/daemon/mgmt/command-validator.cpp b/daemon/mgmt/command-validator.cpp
index 396cfe4..715b5d5 100644
--- a/daemon/mgmt/command-validator.cpp
+++ b/daemon/mgmt/command-validator.cpp
@@ -75,7 +75,7 @@
if (section.begin() == section.end())
{
- throw ConfigFile::Error("No authorize sections found");
+ BOOST_THROW_EXCEPTION(ConfigFile::Error("No authorize sections found"));
}
std::stringstream dryRunErrors;
@@ -92,7 +92,7 @@
std::string msg = "No certfile specified";
if (!isDryRun)
{
- throw ConfigFile::Error(msg);
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(msg));
}
aggregateErrors(dryRunErrors, msg);
continue;
@@ -112,7 +112,7 @@
std::string msg = "Unable to open certificate file " + certfilePath.native();
if (!isDryRun)
{
- throw ConfigFile::Error(msg);
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(msg));
}
aggregateErrors(dryRunErrors, msg);
continue;
@@ -131,7 +131,7 @@
std::string msg = "Malformed certificate file " + certfilePath.native();
if (!isDryRun)
{
- throw ConfigFile::Error(msg);
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(msg));
}
aggregateErrors(dryRunErrors, msg);
continue;
@@ -160,7 +160,7 @@
certfile + " (" + keyNameForLogging + ")";
if (!isDryRun)
{
- throw ConfigFile::Error(msg);
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(msg));
}
aggregateErrors(dryRunErrors, msg);
continue;
@@ -196,7 +196,7 @@
"\" for certificate file " + certfile + " (" + keyNameForLogging + ")";
if (!isDryRun)
{
- throw ConfigFile::Error(msg);
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(msg));
}
aggregateErrors(dryRunErrors, msg);
}
@@ -205,7 +205,7 @@
if (!dryRunErrors.str().empty())
{
- throw ConfigFile::Error(dryRunErrors.str());
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(dryRunErrors.str()));
}
}
@@ -214,7 +214,7 @@
{
if (m_supportedPrivileges.find(privilege) != m_supportedPrivileges.end())
{
- throw CommandValidator::Error("Duplicated privilege: " + privilege);
+ BOOST_THROW_EXCEPTION(CommandValidator::Error("Duplicated privilege: " + privilege));
}
m_supportedPrivileges.insert(privilege);
}