Replace nfd::getExtendedErrorMessage with boost::diagnostic_information
Refs: #4834
Change-Id: I7fc00960d7e5a97748b2277c525a19775810377f
diff --git a/tests/limited-io.cpp b/tests/limited-io.cpp
index f31ec9c..a9da60e 100644
--- a/tests/limited-io.cpp
+++ b/tests/limited-io.cpp
@@ -24,10 +24,11 @@
*/
#include "limited-io.hpp"
-#include "core/extended-error-message.hpp"
#include "core/global-io.hpp"
#include "core/logger.hpp"
+#include <boost/exception/diagnostic_information.hpp>
+
namespace nfd {
namespace tests {
@@ -72,7 +73,7 @@
catch (const StopException&) {
}
catch (const std::exception& ex) {
- NFD_LOG_ERROR("g_io.run() exception: " << getExtendedErrorMessage(ex));
+ NFD_LOG_ERROR("LimitedIo::run: " << boost::diagnostic_information(ex));
m_reason = EXCEPTION;
m_lastException = std::current_exception();
}
diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp
index 5745c03..19aac7c 100644
--- a/tests/other/face-benchmark.cpp
+++ b/tests/other/face-benchmark.cpp
@@ -23,12 +23,13 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "core/extended-error-message.hpp"
#include "core/global-io.hpp"
#include "face/face.hpp"
#include "face/tcp-channel.hpp"
#include "face/udp-channel.hpp"
+#include <boost/exception/diagnostic_information.hpp>
+
#include <fstream>
#include <iostream>
@@ -44,12 +45,16 @@
public:
FaceBenchmark(const char* configFileName)
: m_terminationSignalSet{getGlobalIoService()}
- , m_tcpChannel{tcp::Endpoint{boost::asio::ip::tcp::v4(), 6363}, false, bind([] { return ndn::nfd::FACE_SCOPE_NON_LOCAL; })}
+ , m_tcpChannel{tcp::Endpoint{boost::asio::ip::tcp::v4(), 6363}, false,
+ bind([] { return ndn::nfd::FACE_SCOPE_NON_LOCAL; })}
, m_udpChannel{udp::Endpoint{boost::asio::ip::udp::v4(), 6363}, time::minutes{10}, false}
{
m_terminationSignalSet.add(SIGINT);
m_terminationSignalSet.add(SIGTERM);
- m_terminationSignalSet.async_wait(bind(&FaceBenchmark::terminate, _1, _2));
+ m_terminationSignalSet.async_wait([] (const auto& error, int) {
+ if (!error)
+ getGlobalIoService().stop();
+ });
parseConfig(configFileName);
@@ -63,14 +68,6 @@
}
private:
- static void
- terminate(const boost::system::error_code& error, int signalNo)
- {
- if (error)
- return;
- getGlobalIoService().stop();
- }
-
void
parseConfig(const char* configFileName)
{
@@ -192,7 +189,7 @@
nfd::getGlobalIoService().run();
}
catch (const std::exception& e) {
- std::cerr << "FATAL: " << nfd::getExtendedErrorMessage(e) << std::endl;
+ std::cerr << "ERROR: " << boost::diagnostic_information(e);
return 1;
}
diff --git a/tests/rib-io-fixture.cpp b/tests/rib-io-fixture.cpp
index d058851..91fc979 100644
--- a/tests/rib-io-fixture.cpp
+++ b/tests/rib-io-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,8 +24,8 @@
*/
#include "rib-io-fixture.hpp"
-#include "core/extended-error-message.hpp"
-#include <iostream>
+
+#include <boost/exception/diagnostic_information.hpp>
namespace nfd {
namespace tests {
@@ -72,9 +72,9 @@
m_ribPollEndCv.notify_all();
}
}
- catch (const std::exception& e) {
- std::cerr << "Exception in RIB thread: " << getExtendedErrorMessage(e) << std::endl;
- throw;
+ catch (...) {
+ BOOST_WARN_MESSAGE(false, boost::current_exception_diagnostic_information());
+ NDN_THROW_NESTED(std::runtime_error("Fatal exception in RIB thread"));
}
});