Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4962ba
Refs: #2997
diff --git a/src/management/nfd-control-command.cpp b/src/management/nfd-control-command.cpp
index 3c87d3f..d8ab2c6 100644
--- a/src/management/nfd-control-command.cpp
+++ b/src/management/nfd-control-command.cpp
@@ -80,11 +80,13 @@
bool isPresent = presentFields[i];
if (m_required[i]) {
if (!isPresent) {
- throw ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but missing");
+ BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but "
+ "missing"));
}
}
else if (isPresent && !m_optional[i]) {
- throw ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but present");
+ BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but "
+ "present"));
}
}
}
@@ -105,7 +107,7 @@
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == 0) {
- throw ArgumentError("FaceId must not be zero");
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
}
}
@@ -123,7 +125,7 @@
this->ControlCommand::validateRequest(parameters);
if (parameters.getFaceId() == 0) {
- throw ArgumentError("FaceId must not be zero");
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
}
}
@@ -151,7 +153,7 @@
case LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID:
break;
default:
- throw ArgumentError("LocalControlFeature is invalid");
+ BOOST_THROW_EXCEPTION(ArgumentError("LocalControlFeature is invalid"));
}
}
@@ -201,7 +203,7 @@
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == 0) {
- throw ArgumentError("FaceId must not be zero");
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
}
}
@@ -230,7 +232,7 @@
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == 0) {
- throw ArgumentError("FaceId must not be zero");
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
}
}
@@ -257,7 +259,7 @@
this->ControlCommand::validateRequest(parameters);
if (parameters.getName().size() == 0) {
- throw ArgumentError("Name must not be ndn:/");
+ BOOST_THROW_EXCEPTION(ArgumentError("Name must not be ndn:/"));
}
}
@@ -309,7 +311,7 @@
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == 0) {
- throw ArgumentError("FaceId must not be zero");
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
}
}
@@ -343,7 +345,7 @@
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == 0) {
- throw ArgumentError("FaceId must not be zero");
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
}
}