Implement support for stack traces for STL exceptions.

Fixes #5114
This commit is contained in:
Gunnar Beutner 2013-11-20 21:55:14 +01:00
parent 4534bb08c5
commit 39dcf20a89
23 changed files with 80 additions and 76 deletions

View File

@ -24,7 +24,7 @@
#include "base/objectlock.h" #include "base/objectlock.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include <boost/exception/diagnostic_information.hpp> #include "base/exception.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
using namespace icinga; using namespace icinga;
@ -151,7 +151,7 @@ void CheckerComponent::ExecuteCheckHelper(const Service::Ptr& service)
try { try {
service->ExecuteCheck(); service->ExecuteCheck();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + boost::diagnostic_information(ex)); Log(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + DiagnosticInformation(ex));
} }
{ {

View File

@ -30,7 +30,6 @@
#include "base/application.h" #include "base/application.h"
#include "base/convert.h" #include "base/convert.h"
#include <fstream> #include <fstream>
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -646,7 +645,7 @@ void ClusterListener::ClusterTimerHandler(void)
} catch (std::exception& ex) { } catch (std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception occured while reconnecting to endpoint '" msgbuf << "Exception occured while reconnecting to endpoint '"
<< endpoint->GetName() << "': " << boost::diagnostic_information(ex); << endpoint->GetName() << "': " << DiagnosticInformation(ex);
Log(LogWarning, "cluster", msgbuf.str()); Log(LogWarning, "cluster", msgbuf.str());
} }
} }
@ -959,7 +958,7 @@ void ClusterListener::AsyncMessageHandler(const Endpoint::Ptr& sender, const Dic
void ClusterListener::MessageExceptionHandler(boost::exception_ptr exp) void ClusterListener::MessageExceptionHandler(boost::exception_ptr exp)
{ {
Log(LogCritical, "cluster", "Exception while processing cluster message: " + boost::diagnostic_information(exp)); Log(LogCritical, "cluster", "Exception while processing cluster message: " + DiagnosticInformation(exp));
} }
void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictionary::Ptr& message) void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictionary::Ptr& message)

View File

@ -24,6 +24,7 @@
#include "base/objectlock.h" #include "base/objectlock.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/exception.h"
#include "config/configitembuilder.h" #include "config/configitembuilder.h"
using namespace icinga; using namespace icinga;
@ -74,7 +75,7 @@ void Endpoint::SendMessage(const Dictionary::Ptr& message)
JsonRpc::SendMessage(client, message); JsonRpc::SendMessage(client, message);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Error while sending JSON-RPC message for endpoint '" << GetName() << "': " << boost::diagnostic_information(ex); msgbuf << "Error while sending JSON-RPC message for endpoint '" << GetName() << "': " << DiagnosticInformation(ex);
Log(LogWarning, "cluster", msgbuf.str()); Log(LogWarning, "cluster", msgbuf.str());
m_Client.reset(); m_Client.reset();
@ -91,7 +92,7 @@ void Endpoint::MessageThreadProc(const Stream::Ptr& stream)
try { try {
message = JsonRpc::ReadMessage(stream); message = JsonRpc::ReadMessage(stream);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogWarning, "cluster", "Error while reading JSON-RPC message for endpoint '" + GetName() + "': " + boost::diagnostic_information(ex)); Log(LogWarning, "cluster", "Error while reading JSON-RPC message for endpoint '" + GetName() + "': " + DiagnosticInformation(ex));
m_Client.reset(); m_Client.reset();

View File

@ -22,7 +22,6 @@
#include "base/objectlock.h" #include "base/objectlock.h"
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/serializer.h" #include "base/serializer.h"
#include <boost/exception/diagnostic_information.hpp>
#include <iostream> #include <iostream>
using namespace icinga; using namespace icinga;

View File

@ -23,7 +23,6 @@
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/exception.h" #include "base/exception.h"
#include "base/application.h" #include "base/application.h"
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -120,7 +119,7 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
ExternalCommandProcessor::Execute(command); ExternalCommandProcessor::Execute(command);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "External command failed: " << boost::diagnostic_information(ex); msgbuf << "External command failed: " << DiagnosticInformation(ex);
Log(LogWarning, "compat", msgbuf.str()); Log(LogWarning, "compat", msgbuf.str());
} }
} }

View File

@ -35,7 +35,6 @@
#include "base/application.h" #include "base/application.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <fstream> #include <fstream>

View File

@ -27,7 +27,6 @@
#include "db_ido/dbtype.h" #include "db_ido/dbtype.h"
#include "db_ido/dbvalue.h" #include "db_ido/dbvalue.h"
#include "db_ido_mysql/idomysqlconnection.h" #include "db_ido_mysql/idomysqlconnection.h"
#include <boost/exception/diagnostic_information.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
@ -67,7 +66,7 @@ void IdoMysqlConnection::Stop(void)
void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp) void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
{ {
Log(LogCritical, "db_ido_mysql", "Exception during database operation: " + boost::diagnostic_information(exp)); Log(LogCritical, "db_ido_mysql", "Exception during database operation: " + DiagnosticInformation(exp));
boost::mutex::scoped_lock lock(m_ConnectionMutex); boost::mutex::scoped_lock lock(m_ConnectionMutex);

View File

@ -27,7 +27,6 @@
#include "db_ido/dbtype.h" #include "db_ido/dbtype.h"
#include "db_ido/dbvalue.h" #include "db_ido/dbvalue.h"
#include "db_ido_pgsql/idopgsqlconnection.h" #include "db_ido_pgsql/idopgsqlconnection.h"
#include <boost/exception/diagnostic_information.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
@ -67,7 +66,7 @@ void IdoPgsqlConnection::Stop(void)
void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp) void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp)
{ {
Log(LogCritical, "db_ido_pgsql", "Exception during database operation: " + boost::diagnostic_information(exp)); Log(LogCritical, "db_ido_pgsql", "Exception during database operation: " + DiagnosticInformation(exp));
boost::mutex::scoped_lock lock(m_ConnectionMutex); boost::mutex::scoped_lock lock(m_ConnectionMutex);

View File

@ -29,7 +29,6 @@
#include "base/application.h" #include "base/application.h"
#include "base/scriptfunction.h" #include "base/scriptfunction.h"
#include "base/convert.h" #include "base/convert.h"
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -139,7 +138,7 @@ void LivestatusListener::ClientThreadProc(const Socket::Ptr& client)
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream info; std::ostringstream info;
info << "Exception thrown while running livestatus query: " << std::endl info << "Exception thrown while running livestatus query: " << std::endl
<< boost::diagnostic_information(ex); << DiagnosticInformation(ex);
Log(LogCritical, "livestatus", info.str()); Log(LogCritical, "livestatus", info.str());
return; return;
} }

View File

@ -498,7 +498,7 @@ void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream info; std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< boost::diagnostic_information(ex); << DiagnosticInformation(ex);
Log(LogCritical, "livestatus", info.str()); Log(LogCritical, "livestatus", info.str());
} }
} }
@ -518,7 +518,7 @@ void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream info; std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< boost::diagnostic_information(ex); << DiagnosticInformation(ex);
Log(LogCritical, "livestatus", info.str()); Log(LogCritical, "livestatus", info.str());
} }
} }
@ -537,11 +537,7 @@ bool Query::Execute(const Stream::Ptr& stream)
else else
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid livestatus query verb.")); BOOST_THROW_EXCEPTION(std::runtime_error("Invalid livestatus query verb."));
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
StackTrace *st = Exception::GetLastStackTrace(); SendResponse(stream, LivestatusErrorQuery, DiagnosticInformation(ex));
std::ostringstream info;
st->Print(info);
Log(LogDebug, "livestatus", info.str());
SendResponse(stream, LivestatusErrorQuery, boost::diagnostic_information(ex));
} }
if (!m_KeepAlive) { if (!m_KeepAlive) {

View File

@ -23,7 +23,7 @@
#include "base/objectlock.h" #include "base/objectlock.h"
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/utility.h" #include "base/utility.h"
#include <boost/exception/diagnostic_information.hpp> #include "base/exception.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
using namespace icinga; using namespace icinga;
@ -90,7 +90,7 @@ void NotificationComponent::NotificationTimerHandler(void)
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception occured during notification for service '" msgbuf << "Exception occured during notification for service '"
<< GetName() << "': " << boost::diagnostic_information(ex); << GetName() << "': " << DiagnosticInformation(ex);
String message = msgbuf.str(); String message = msgbuf.str();
Log(LogWarning, "icinga", message); Log(LogWarning, "icinga", message);

View File

@ -33,12 +33,12 @@
#include "base/stream.h" #include "base/stream.h"
#include "base/networkstream.h" #include "base/networkstream.h"
#include "base/bufferedstream.h" #include "base/bufferedstream.h"
#include "base/exception.h"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -143,7 +143,7 @@ void GraphiteWriter::SendMetric(const String& prefix, const String& name, double
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception thrown while writing to the Graphite socket: " << std::endl msgbuf << "Exception thrown while writing to the Graphite socket: " << std::endl
<< boost::diagnostic_information(ex); << DiagnosticInformation(ex);
Log(LogCritical, "base", msgbuf.str()); Log(LogCritical, "base", msgbuf.str());

View File

@ -34,7 +34,6 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <boost/exception/errinfo_api_function.hpp> #include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_errno.hpp> #include <boost/exception/errinfo_errno.hpp>
@ -399,23 +398,12 @@ void Application::ExceptionHandler(void)
sigaction(SIGABRT, &sa, NULL); sigaction(SIGABRT, &sa, NULL);
#endif /* _WIN32 */ #endif /* _WIN32 */
bool has_trace = false;
try { try {
throw; throw;
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::cerr << std::endl std::cerr << std::endl
<< boost::diagnostic_information(ex) << DiagnosticInformation(ex)
<< std::endl; << std::endl;
has_trace = (boost::get_error_info<StackTraceErrorInfo>(ex) != NULL);
} catch (...) {
std::cerr << "Exception of unknown type." << std::endl;
}
if (!has_trace) {
StackTrace trace;
trace.Print(std::cerr, 1);
} }
DisplayBugMessage(); DisplayBugMessage();

View File

@ -21,7 +21,7 @@
using namespace icinga; using namespace icinga;
boost::thread_specific_ptr<StackTrace> Exception::m_LastStackTrace; static boost::thread_specific_ptr<StackTrace> l_LastStackTrace;
#ifndef _WIN32 #ifndef _WIN32
extern "C" extern "C"
@ -44,7 +44,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
#endif /* __APPLE__ */ #endif /* __APPLE__ */
StackTrace trace; StackTrace trace;
Exception::SetLastStackTrace(trace); SetLastExceptionStack(trace);
#ifndef __APPLE__ #ifndef __APPLE__
/* Check if thrown_ptr inherits from boost::exception. */ /* Check if thrown_ptr inherits from boost::exception. */
@ -59,13 +59,30 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
} }
#endif /* _WIN32 */ #endif /* _WIN32 */
StackTrace *Exception::GetLastStackTrace(void) StackTrace *icinga::GetLastExceptionStack(void)
{ {
return m_LastStackTrace.get(); return l_LastStackTrace.get();
} }
void Exception::SetLastStackTrace(const StackTrace& trace) void icinga::SetLastExceptionStack(const StackTrace& trace)
{ {
m_LastStackTrace.reset(new StackTrace(trace)); l_LastStackTrace.reset(new StackTrace(trace));
}
String icinga::DiagnosticInformation(boost::exception_ptr eptr)
{
StackTrace *pt = GetLastExceptionStack();
StackTrace trace;
if (pt)
trace = *pt;
try {
boost::rethrow_exception(eptr);
} catch (const std::exception& ex) {
return DiagnosticInformation(ex, pt ? &trace : NULL);
}
return boost::diagnostic_information(eptr);
} }

View File

@ -28,6 +28,8 @@
#include <boost/exception/errinfo_api_function.hpp> #include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_errno.hpp> #include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_file_name.hpp> #include <boost/exception/errinfo_file_name.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp>
#ifdef _WIN32 #ifdef _WIN32
# include <boost/algorithm/string/trim.hpp> # include <boost/algorithm/string/trim.hpp>
@ -36,23 +38,32 @@
namespace icinga namespace icinga
{ {
/** I2_BASE_API StackTrace *GetLastExceptionStack(void);
* Base class for all exceptions. I2_BASE_API void SetLastExceptionStack(const StackTrace& trace);
*
* @ingroup base
*/
class I2_BASE_API Exception
{
public:
static StackTrace *GetLastStackTrace(void);
static void SetLastStackTrace(const StackTrace& trace);
private:
static boost::thread_specific_ptr<StackTrace> m_LastStackTrace;
};
typedef boost::error_info<StackTrace, StackTrace> StackTraceErrorInfo; typedef boost::error_info<StackTrace, StackTrace> StackTraceErrorInfo;
template<typename T>
String DiagnosticInformation(const T& ex, StackTrace *trace = NULL)
{
std::ostringstream result;
result << boost::diagnostic_information(ex);
if (boost::get_error_info<StackTraceErrorInfo>(ex) == NULL) {
result << std::endl;
if (trace)
result << *trace;
else
result << *GetLastExceptionStack();
}
return result.str();
}
I2_BASE_API String DiagnosticInformation(boost::exception_ptr eptr);
class I2_BASE_API posix_error : virtual public std::exception, virtual public boost::exception { }; class I2_BASE_API posix_error : virtual public std::exception, virtual public boost::exception { };
#ifdef _WIN32 #ifdef _WIN32

View File

@ -24,10 +24,10 @@
#include "base/utility.h" #include "base/utility.h"
#include "base/scriptvariable.h" #include "base/scriptvariable.h"
#include "base/application.h" #include "base/application.h"
#include "base/exception.h"
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
using namespace icinga; using namespace icinga;
@ -124,7 +124,7 @@ void ThreadPool::QueueThreadProc(int tid)
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception thrown in event handler: " << std::endl msgbuf << "Exception thrown in event handler: " << std::endl
<< boost::diagnostic_information(ex); << DiagnosticInformation(ex);
Log(LogCritical, "base", msgbuf.str()); Log(LogCritical, "base", msgbuf.str());
} catch (...) { } catch (...) {

View File

@ -22,7 +22,6 @@
#include "base/debug.h" #include "base/debug.h"
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;

View File

@ -31,9 +31,9 @@
#include "base/utility.h" #include "base/utility.h"
#include "base/array.h" #include "base/array.h"
#include "base/scriptvariable.h" #include "base/scriptvariable.h"
#include "base/exception.h"
#include <sstream> #include <sstream>
#include <stack> #include <stack>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#define YYLTYPE icinga::DebugInfo #define YYLTYPE icinga::DebugInfo
@ -140,7 +140,7 @@ void ConfigCompiler::Compile(void)
try { try {
yyparse(this); yyparse(this);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
ConfigCompilerContext::GetInstance()->AddMessage(true, boost::diagnostic_information(ex)); ConfigCompilerContext::GetInstance()->AddMessage(true, DiagnosticInformation(ex));
} }
} }

View File

@ -30,10 +30,10 @@
#include "base/objectlock.h" #include "base/objectlock.h"
#include "base/application.h" #include "base/application.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/exception.h"
#include <fstream> #include <fstream>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
using namespace icinga; using namespace icinga;
@ -982,7 +982,7 @@ void ExternalCommandProcessor::ProcessFile(double, const std::vector<String>& ar
Execute(line); Execute(line);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "External command failed: " << boost::diagnostic_information(ex); msgbuf << "External command failed: " << DiagnosticInformation(ex);
Log(LogWarning, "icinga", msgbuf.str()); Log(LogWarning, "icinga", msgbuf.str());
} }
} }

View File

@ -26,9 +26,9 @@
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/convert.h" #include "base/convert.h"
#include "base/exception.h"
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -296,7 +296,7 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User::
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception occured during notification for service '" msgbuf << "Exception occured during notification for service '"
<< GetService()->GetName() << "': " << boost::diagnostic_information(ex); << GetService()->GetName() << "': " << DiagnosticInformation(ex);
Log(LogWarning, "icinga", msgbuf.str()); Log(LogWarning, "icinga", msgbuf.str());
} }
} }

View File

@ -26,8 +26,8 @@
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/convert.h" #include "base/convert.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/exception.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
using namespace icinga; using namespace icinga;
@ -478,7 +478,7 @@ void Service::ExecuteCheck(void)
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception occured during check for service '" msgbuf << "Exception occured during check for service '"
<< GetName() << "': " << boost::diagnostic_information(ex); << GetName() << "': " << DiagnosticInformation(ex);
String message = msgbuf.str(); String message = msgbuf.str();
Log(LogWarning, "icinga", message); Log(LogWarning, "icinga", message);

View File

@ -24,10 +24,10 @@
#include "base/logger_fwd.h" #include "base/logger_fwd.h"
#include "base/timer.h" #include "base/timer.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/exception.h"
#include "config/configitembuilder.h" #include "config/configitembuilder.h"
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -68,7 +68,7 @@ void Service::SendNotifications(NotificationType type, const CheckResult::Ptr& c
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Exception occured during notification for service '" msgbuf << "Exception occured during notification for service '"
<< GetName() << "': " << boost::diagnostic_information(ex); << GetName() << "': " << DiagnosticInformation(ex);
String message = msgbuf.str(); String message = msgbuf.str();
Log(LogWarning, "icinga", message); Log(LogWarning, "icinga", message);

View File

@ -26,7 +26,6 @@
#include "base/array.h" #include "base/array.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/exception/diagnostic_information.hpp>
using namespace icinga; using namespace icinga;
@ -330,7 +329,7 @@ PyObject *PythonLanguage::PyCallNativeFunction(PyObject *self, PyObject *args)
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
PyEval_RestoreThread(tstate); PyEval_RestoreThread(tstate);
String message = boost::diagnostic_information(ex); String message = DiagnosticInformation(ex);
PyErr_SetString(PyExc_RuntimeError, message.CStr()); PyErr_SetString(PyExc_RuntimeError, message.CStr());
return NULL; return NULL;