Enhance exception throwing with Boost Exception library

Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4962ba
Refs: #2997
diff --git a/src/management/nfd-channel-status.cpp b/src/management/nfd-channel-status.cpp
index 2c93283..b53d198 100644
--- a/src/management/nfd-channel-status.cpp
+++ b/src/management/nfd-channel-status.cpp
@@ -82,7 +82,7 @@
 ChannelStatus::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::ChannelStatus) {
-    throw Error("expecting ChannelStatus block");
+    BOOST_THROW_EXCEPTION(Error("Expecting ChannelStatus block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -93,7 +93,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LocalUri field");
+    BOOST_THROW_EXCEPTION(Error("Missing required LocalUri field"));
   }
 }
 
diff --git a/src/management/nfd-command-options.cpp b/src/management/nfd-command-options.cpp
index 72326c9..8a2b9f7 100644
--- a/src/management/nfd-command-options.cpp
+++ b/src/management/nfd-command-options.cpp
@@ -42,7 +42,7 @@
 CommandOptions::setTimeout(const time::milliseconds& timeout)
 {
   if (timeout <= time::milliseconds::zero()) {
-    throw std::out_of_range("timeout must be positive");
+    BOOST_THROW_EXCEPTION(std::out_of_range("Timeout must be positive"));
   }
 
   m_timeout = timeout;
@@ -76,7 +76,8 @@
   case security::SigningInfo::SIGNER_TYPE_CERT:
     return SIGNING_PARAMS_CERTIFICATE;
   default:
-    throw std::out_of_range("SigningInfo::SignerType is not convertible to CommandOptions::SigningParamsKind");
+    BOOST_THROW_EXCEPTION(std::out_of_range("SigningInfo::SignerType is not convertible to "
+                                            "CommandOptions::SigningParamsKind"));
   }
 }
 
@@ -114,7 +115,7 @@
   // A valid IdentityCertificate has at least 4 name components,
   // as it follows `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
   if (certificateName.size() < 4) {
-    throw std::invalid_argument("certificate is invalid");
+    BOOST_THROW_EXCEPTION(std::invalid_argument("Certificate is invalid"));
   }
 
   return security::signingByCertificate(certificateName);
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"));
   }
 }
 
diff --git a/src/management/nfd-control-parameters.cpp b/src/management/nfd-control-parameters.cpp
index eb9fa0f..f8ce363 100644
--- a/src/management/nfd-control-parameters.cpp
+++ b/src/management/nfd-control-parameters.cpp
@@ -115,7 +115,7 @@
 ControlParameters::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::ControlParameters) {
-    throw Error("expecting TLV-TYPE ControlParameters");
+    BOOST_THROW_EXCEPTION(Error("Expecting TLV-TYPE ControlParameters"));
   }
   m_wire = block;
   m_wire.parse();
@@ -168,7 +168,7 @@
   if (this->hasStrategy()) {
     val->parse();
     if (val->elements().empty()) {
-      throw Error("expecting Strategy/Name");
+      BOOST_THROW_EXCEPTION(Error("Expecting Strategy/Name"));
     }
     else {
       m_strategy.wireDecode(*val->elements_begin());
diff --git a/src/management/nfd-control-response.cpp b/src/management/nfd-control-response.cpp
index 0c2166c..7056162 100644
--- a/src/management/nfd-control-response.cpp
+++ b/src/management/nfd-control-response.cpp
@@ -74,13 +74,15 @@
   m_wire.parse();
 
   if (m_wire.type() != tlv::nfd::ControlResponse)
-    throw Error("Requested decoding of ControlResponse, but Block is of different type");
+    BOOST_THROW_EXCEPTION(Error("Requested decoding of ControlResponse, but Block is of different "
+                                "type"));
 
   Block::element_const_iterator val = m_wire.elements_begin();
   if (val == m_wire.elements_end() ||
       val->type() != tlv::nfd::StatusCode)
     {
-      throw Error("Incorrect ControlResponse format (StatusCode missing or not the first item)");
+      BOOST_THROW_EXCEPTION(Error("Incorrect ControlResponse format (StatusCode missing or not the "
+                                  "first item)"));
     }
 
   m_code = readNonNegativeInteger(*val);
@@ -89,7 +91,8 @@
   if (val == m_wire.elements_end() ||
       val->type() != tlv::nfd::StatusText)
     {
-      throw Error("Incorrect ControlResponse format (StatusText missing or not the second item)");
+      BOOST_THROW_EXCEPTION(Error("Incorrect ControlResponse format (StatusText missing or not the "
+                                  "second item)"));
     }
   m_text.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
   ++val;
diff --git a/src/management/nfd-face-event-notification.cpp b/src/management/nfd-face-event-notification.cpp
index 9e757a3..5f80fe8 100644
--- a/src/management/nfd-face-event-notification.cpp
+++ b/src/management/nfd-face-event-notification.cpp
@@ -89,7 +89,7 @@
 FaceEventNotification::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::FaceEventNotification) {
-    throw Error("expecting FaceEventNotification block");
+    BOOST_THROW_EXCEPTION(Error("expecting FaceEventNotification block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -100,7 +100,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceEventKind field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceEventKind field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) {
@@ -108,7 +108,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceId field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceId field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
@@ -116,7 +116,7 @@
     ++val;
   }
   else {
-    throw Error("missing required Uri field");
+    BOOST_THROW_EXCEPTION(Error("missing required Uri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
@@ -124,7 +124,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LocalUri field");
+    BOOST_THROW_EXCEPTION(Error("missing required LocalUri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceScope) {
@@ -132,7 +132,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceScope field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceScope field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) {
@@ -140,7 +140,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FacePersistency field");
+    BOOST_THROW_EXCEPTION(Error("missing required FacePersistency field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) {
@@ -148,7 +148,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LinkType field");
+    BOOST_THROW_EXCEPTION(Error("missing required LinkType field"));
   }
 }
 
diff --git a/src/management/nfd-face-query-filter.cpp b/src/management/nfd-face-query-filter.cpp
index 0fa02f2..bd10d2b 100644
--- a/src/management/nfd-face-query-filter.cpp
+++ b/src/management/nfd-face-query-filter.cpp
@@ -122,7 +122,7 @@
 {
   //all fields are optional
   if (block.type() != tlv::nfd::FaceQueryFilter) {
-    throw Error("expecting FaceQueryFilter block");
+    BOOST_THROW_EXCEPTION(Error("expecting FaceQueryFilter block"));
   }
 
   m_wire = block;
@@ -350,4 +350,3 @@
 
 } // namespace nfd
 } // namespace ndn
-
diff --git a/src/management/nfd-face-status.cpp b/src/management/nfd-face-status.cpp
index becaa75..30af9fb 100644
--- a/src/management/nfd-face-status.cpp
+++ b/src/management/nfd-face-status.cpp
@@ -115,7 +115,7 @@
 FaceStatus::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::FaceStatus) {
-    throw Error("expecting FaceStatus block");
+    BOOST_THROW_EXCEPTION(Error("expecting FaceStatus block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -126,7 +126,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceId field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceId field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
@@ -134,7 +134,7 @@
     ++val;
   }
   else {
-    throw Error("missing required Uri field");
+    BOOST_THROW_EXCEPTION(Error("missing required Uri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
@@ -142,7 +142,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LocalUri field");
+    BOOST_THROW_EXCEPTION(Error("missing required LocalUri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::ExpirationPeriod) {
@@ -160,7 +160,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceScope field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceScope field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) {
@@ -168,7 +168,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FacePersistency field");
+    BOOST_THROW_EXCEPTION(Error("missing required FacePersistency field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) {
@@ -176,7 +176,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LinkType field");
+    BOOST_THROW_EXCEPTION(Error("missing required LinkType field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
@@ -184,7 +184,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) {
@@ -192,7 +192,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInDatas field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) {
@@ -200,7 +200,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) {
@@ -208,7 +208,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutDatas field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInBytes) {
@@ -216,7 +216,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInBytes field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInBytes field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutBytes) {
@@ -224,7 +224,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutBytes field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutBytes field"));
   }
 }
 
diff --git a/src/management/nfd-fib-entry.cpp b/src/management/nfd-fib-entry.cpp
index b8c5274..fb07329 100644
--- a/src/management/nfd-fib-entry.cpp
+++ b/src/management/nfd-fib-entry.cpp
@@ -124,31 +124,31 @@
     std::stringstream error;
     error << "Requested decoding of NextHopRecord, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_wire.parse();
 
   Block::element_const_iterator val = m_wire.elements_begin();
   if (val == m_wire.elements_end()) {
-    throw Error("Unexpected end of NextHopRecord");
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of NextHopRecord"));
   }
   else if (val->type() != tlv::nfd::FaceId) {
     std::stringstream error;
     error << "Expected FaceId, but Block is of a different type: #"
           << val->type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_faceId = readNonNegativeInteger(*val);
   ++val;
 
   if (val == m_wire.elements_end()) {
-    throw Error("Unexpected end of NextHopRecord");
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of NextHopRecord"));
   }
   else if (val->type() != tlv::nfd::Cost) {
     std::stringstream error;
     error << "Expected Cost, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_cost = readNonNegativeInteger(*val);
 }
@@ -235,20 +235,20 @@
     std::stringstream error;
     error << "Requested decoding of FibEntry, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
 
   m_wire.parse();
 
   Block::element_const_iterator val = m_wire.elements_begin();
   if (val == m_wire.elements_end()) {
-    throw Error("Unexpected end of FibEntry");
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of FibEntry"));
   }
   else if (val->type() != tlv::Name) {
     std::stringstream error;
     error << "Expected Name, but Block is of a different type: #"
           << val->type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_prefix.wireDecode(*val);
   ++val;
@@ -258,7 +258,7 @@
       std::stringstream error;
       error << "Expected NextHopRecords, but Block is of a different type: #"
             << val->type();
-      throw Error(error.str());
+      BOOST_THROW_EXCEPTION(Error(error.str()));
     }
     m_nextHopRecords.push_back(NextHopRecord(*val));
   }
diff --git a/src/management/nfd-forwarder-status.cpp b/src/management/nfd-forwarder-status.cpp
index 4e989ee..81b3bb9 100644
--- a/src/management/nfd-forwarder-status.cpp
+++ b/src/management/nfd-forwarder-status.cpp
@@ -116,7 +116,7 @@
 ForwarderStatus::wireDecode(const Block& block)
 {
   if (block.type() != tlv::Content) {
-    throw Error("expecting Content block for Status payload");
+    BOOST_THROW_EXCEPTION(Error("expecting Content block for Status payload"));
   }
   m_wire = block;
   m_wire.parse();
@@ -127,7 +127,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NfdVersion field");
+    BOOST_THROW_EXCEPTION(Error("missing required NfdVersion field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::StartTimestamp) {
@@ -135,7 +135,7 @@
     ++val;
   }
   else {
-    throw Error("missing required StartTimestamp field");
+    BOOST_THROW_EXCEPTION(Error("missing required StartTimestamp field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::CurrentTimestamp) {
@@ -143,7 +143,7 @@
     ++val;
   }
   else {
-    throw Error("missing required CurrentTimestamp field");
+    BOOST_THROW_EXCEPTION(Error("missing required CurrentTimestamp field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NNameTreeEntries) {
@@ -151,7 +151,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NNameTreeEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NNameTreeEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NFibEntries) {
@@ -159,7 +159,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NFibEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NFibEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NPitEntries) {
@@ -167,7 +167,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NPitEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NPitEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NMeasurementsEntries) {
@@ -175,7 +175,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NMeasurementsEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NMeasurementsEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NCsEntries) {
@@ -183,7 +183,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NCsEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NCsEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
@@ -191,7 +191,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) {
@@ -199,7 +199,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInDatas field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) {
@@ -207,7 +207,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) {
@@ -215,7 +215,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutDatas field"));
   }
 }
 
diff --git a/src/management/nfd-local-control-header.hpp b/src/management/nfd-local-control-header.hpp
index 8108230..327035d 100644
--- a/src/management/nfd-local-control-header.hpp
+++ b/src/management/nfd-local-control-header.hpp
@@ -250,7 +250,8 @@
 {
   /// @todo should this be BOOST_ASSERT instead?  This is kind of unnecessary overhead
   if (empty(encodeMask))
-    throw Error("Requested wire for LocalControlHeader, but none of the fields are set or enabled");
+    BOOST_THROW_EXCEPTION(Error("Requested wire for LocalControlHeader, but none of the fields are "
+                                "set or enabled"));
 
   EncodingEstimator estimator;
   size_t length = wireEncode(estimator, payload.wireEncode().size(), encodeMask);
@@ -297,7 +298,7 @@
               m_cachingPolicy = CachingPolicy::NO_CACHE;
             }
             else {
-              throw Error("CachingPolicy: Missing required NoCache field");
+              BOOST_THROW_EXCEPTION(Error("CachingPolicy: Missing required NoCache field"));
             }
           }
           break;
diff --git a/src/management/nfd-rib-entry.cpp b/src/management/nfd-rib-entry.cpp
index ab78d5c..7c056cd 100644
--- a/src/management/nfd-rib-entry.cpp
+++ b/src/management/nfd-rib-entry.cpp
@@ -130,7 +130,7 @@
     std::stringstream error;
     error << "Expected Route Block, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
 
   m_wire.parse();
@@ -142,7 +142,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required FaceId field");
+    BOOST_THROW_EXCEPTION(Error("Missing required FaceId field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Origin) {
@@ -150,7 +150,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Origin field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Origin field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Cost) {
@@ -158,7 +158,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Cost field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Cost field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Flags) {
@@ -166,7 +166,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Flags field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Flags field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::ExpirationPeriod) {
@@ -272,7 +272,7 @@
     std::stringstream error;
     error << "Expected RibEntry Block, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
 
   m_wire.parse();
@@ -284,7 +284,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Name field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Name field"));
   }
 
   for (; val != m_wire.elements_end(); ++val) {
@@ -296,7 +296,7 @@
       std::stringstream error;
       error << "Expected Route Block, but Block is of a different type: #"
             << m_wire.type();
-      throw Error(error.str());
+      BOOST_THROW_EXCEPTION(Error(error.str()));
     }
   }
 }
diff --git a/src/management/nfd-strategy-choice.cpp b/src/management/nfd-strategy-choice.cpp
index 6283acd..659293c 100644
--- a/src/management/nfd-strategy-choice.cpp
+++ b/src/management/nfd-strategy-choice.cpp
@@ -82,7 +82,7 @@
 StrategyChoice::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::StrategyChoice) {
-    throw Error("expecting StrategyChoice block");
+    BOOST_THROW_EXCEPTION(Error("expecting StrategyChoice block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -93,13 +93,13 @@
     ++val;
   }
   else {
-    throw Error("missing required Name field");
+    BOOST_THROW_EXCEPTION(Error("missing required Name field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Strategy) {
     val->parse();
     if (val->elements().empty()) {
-      throw Error("expecting Strategy/Name");
+      BOOST_THROW_EXCEPTION(Error("expecting Strategy/Name"));
     }
     else {
       m_strategy.wireDecode(*val->elements_begin());
@@ -107,7 +107,7 @@
     ++val;
   }
   else {
-    throw Error("missing required Strategy field");
+    BOOST_THROW_EXCEPTION(Error("missing required Strategy field"));
   }
 }