Another build fix for Windows

refs #9182
This commit is contained in:
Gunnar Beutner 2016-08-31 13:43:14 +02:00
parent 2729e98c69
commit 06cb3cf875
17 changed files with 60 additions and 57 deletions

View File

@ -49,7 +49,7 @@ MainForm::MainForm(wxWindow *parent, const Url::Ptr& url)
m_PropertyGrid->SetColumnCount(3);
}
void MainForm::TypesCompletionHandler(std::exception_ptr eptr, const std::vector<ApiType::Ptr>& types, bool forward)
void MainForm::TypesCompletionHandler(boost::exception_ptr eptr, const std::vector<ApiType::Ptr>& types, bool forward)
{
if (forward) {
CallAfter(boost::bind(&MainForm::TypesCompletionHandler, this, eptr, types, false));
@ -60,7 +60,7 @@ void MainForm::TypesCompletionHandler(std::exception_ptr eptr, const std::vector
if (eptr) {
try {
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
} catch (const std::exception& ex) {
std::string message = "HTTP query failed: " + std::string(ex.what());
wxMessageBox(message, "Icinga Studio", wxOK | wxCENTRE | wxICON_ERROR, this);
@ -122,7 +122,7 @@ static bool ApiObjectLessComparer(const ApiObject::Ptr& o1, const ApiObject::Ptr
return o1->Name < o2->Name;
}
void MainForm::ObjectsCompletionHandler(std::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward)
void MainForm::ObjectsCompletionHandler(boost::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward)
{
if (forward) {
CallAfter(boost::bind(&MainForm::ObjectsCompletionHandler, this, eptr, objects, false));
@ -134,7 +134,7 @@ void MainForm::ObjectsCompletionHandler(std::exception_ptr eptr, const std::vect
if (eptr) {
try {
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
} catch (const std::exception& ex) {
std::string message = "HTTP query failed: " + std::string(ex.what());
wxMessageBox(message, "Icinga Studio", wxOK | wxCENTRE | wxICON_ERROR, this);
@ -236,7 +236,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
}
}
void MainForm::ObjectDetailsCompletionHandler(std::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward)
void MainForm::ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward)
{
if (forward) {
CallAfter(boost::bind(&MainForm::ObjectDetailsCompletionHandler, this, eptr, objects, false));
@ -247,7 +247,7 @@ void MainForm::ObjectDetailsCompletionHandler(std::exception_ptr eptr, const std
if (eptr) {
try {
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
} catch (const std::exception& ex) {
std::string message = "HTTP query failed: " + std::string(ex.what());
wxMessageBox(message, "Icinga Studio", wxOK | wxCENTRE | wxICON_ERROR, this);

View File

@ -42,9 +42,9 @@ private:
ApiClient::Ptr m_ApiClient;
std::map<String, ApiType::Ptr> m_Types;
void TypesCompletionHandler(std::exception_ptr eptr, const std::vector<ApiType::Ptr>& types, bool forward);
void ObjectsCompletionHandler(std::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward);
void ObjectDetailsCompletionHandler(std::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward);
void TypesCompletionHandler(boost::exception_ptr eptr, const std::vector<ApiType::Ptr>& types, bool forward);
void ObjectsCompletionHandler(boost::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward);
void ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const std::vector<ApiObject::Ptr>& objects, bool forward);
wxPGProperty *ValueToProperty(const String& name, const Value& value);
};

View File

@ -260,7 +260,7 @@ String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, Sta
return result.str();
}
String icinga::DiagnosticInformation(std::exception_ptr eptr, bool verbose)
String icinga::DiagnosticInformation(boost::exception_ptr eptr, bool verbose)
{
StackTrace *pt = GetLastExceptionStack();
StackTrace stack;
@ -275,7 +275,7 @@ String icinga::DiagnosticInformation(std::exception_ptr eptr, bool verbose)
context = *pc;
try {
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
} catch (const std::exception& ex) {
return DiagnosticInformation(ex, verbose, pt ? &stack : NULL, pc ? &context : NULL);
}

View File

@ -29,11 +29,11 @@
#include "base/dictionary.hpp"
#include "base/configobject.hpp"
#include <sstream>
#include <exception>
#include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_file_name.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp>
#ifdef _WIN32
# include <boost/algorithm/string/trim.hpp>
@ -121,7 +121,7 @@ inline std::string to_string(const ContextTraceErrorInfo& e)
}
I2_BASE_API String DiagnosticInformation(const std::exception& ex, bool verbose = true, StackTrace *stack = NULL, ContextTrace *context = NULL);
I2_BASE_API String DiagnosticInformation(std::exception_ptr eptr, bool verbose = true);
I2_BASE_API String DiagnosticInformation(boost::exception_ptr eptr, bool verbose = true);
class I2_BASE_API posix_error : virtual public std::exception, virtual public boost::exception {
public:

View File

@ -23,11 +23,11 @@
#include "base/array.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include <boost/exception_ptr.hpp>
#include <yajl/yajl_version.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_parse.h>
#include <stack>
#include <exception>
using namespace icinga;
@ -188,19 +188,19 @@ public:
void SaveException(void)
{
m_Exception = std::current_exception();
m_Exception = boost::current_exception();
}
void ThrowException(void) const
{
if (m_Exception)
std::rethrow_exception(m_Exception);
boost::rethrow_exception(m_Exception);
}
private:
std::stack<JsonElement> m_Stack;
Value m_Key;
std::exception_ptr m_Exception;
boost::exception_ptr m_Exception;
};
static int DecodeNull(void *ctx)

View File

@ -161,7 +161,7 @@ bool WorkQueue::HasExceptions(void) const
* Returns all exceptions which have occurred for tasks in this work queue. When a
* custom exception callback is set this method will always return an empty list.
*/
std::vector<std::exception_ptr> WorkQueue::GetExceptions(void) const
std::vector<boost::exception_ptr> WorkQueue::GetExceptions(void) const
{
boost::mutex::scoped_lock lock(m_Mutex);
@ -170,7 +170,7 @@ std::vector<std::exception_ptr> WorkQueue::GetExceptions(void) const
void WorkQueue::ReportExceptions(const String& facility) const
{
std::vector<std::exception_ptr> exceptions = GetExceptions();
std::vector<boost::exception_ptr> exceptions = GetExceptions();
for (const auto& eptr : exceptions) {
Log(LogCritical, facility)
@ -235,12 +235,12 @@ void WorkQueue::WorkerThreadProc(void)
lock.lock();
if (!m_ExceptionCallback)
m_Exceptions.push_back(std::current_exception());
m_Exceptions.push_back(boost::current_exception());
lock.unlock();
if (m_ExceptionCallback)
m_ExceptionCallback(std::current_exception());
m_ExceptionCallback(boost::current_exception());
}
/* clear the task so whatever other resources it holds are released

View File

@ -26,9 +26,9 @@
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/exception_ptr.hpp>
#include <queue>
#include <deque>
#include <exception>
namespace icinga
{
@ -78,7 +78,7 @@ inline bool operator<(const Task& a, const Task& b)
class I2_BASE_API WorkQueue
{
public:
typedef boost::function<void (std::exception_ptr)> ExceptionCallback;
typedef boost::function<void (boost::exception_ptr)> ExceptionCallback;
WorkQueue(size_t maxItems = 0, int threadCount = 1);
~WorkQueue(void);
@ -97,7 +97,7 @@ public:
void SetExceptionCallback(const ExceptionCallback& callback);
bool HasExceptions(void) const;
std::vector<std::exception_ptr> GetExceptions(void) const;
std::vector<boost::exception_ptr> GetExceptions(void) const;
void ReportExceptions(const String& facility) const;
private:
@ -118,7 +118,7 @@ private:
std::priority_queue<Task, std::deque<Task> > m_Tasks;
int m_NextTaskID;
ExceptionCallback m_ExceptionCallback;
std::vector<std::exception_ptr> m_Exceptions;
std::vector<boost::exception_ptr> m_Exceptions;
Timer::Ptr m_StatusTimer;
void WorkerThreadProc(void);

View File

@ -378,7 +378,7 @@ incomplete:
boost::mutex mutex;
boost::condition_variable cv;
bool ready = false;
std::exception_ptr eptr;
boost::exception_ptr eptr;
l_ApiClient->ExecuteScript(l_Session, command, scriptFrame.Sandboxed,
boost::bind(&ConsoleCommand::ExecuteScriptCompletionHandler,
@ -393,7 +393,7 @@ incomplete:
}
if (eptr)
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
}
if (commandOnce.IsEmpty()) {
@ -466,13 +466,13 @@ incomplete:
}
void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, std::exception_ptr eptr, const Value& result, Value& resultOut, std::exception_ptr& eptrOut)
bool& ready, boost::exception_ptr eptr, const Value& result, Value& resultOut, boost::exception_ptr& eptrOut)
{
if (eptr) {
try {
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
} catch (const ScriptError& ex) {
eptrOut = std::current_exception();
eptrOut = boost::current_exception();
} catch (const std::exception& ex) {
Log(LogCritical, "ConsoleCommand")
<< "HTTP query failed: " << ex.what();
@ -490,11 +490,11 @@ void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::
}
void ConsoleCommand::AutocompleteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, std::exception_ptr eptr, const Array::Ptr& result, Array::Ptr& resultOut)
bool& ready, boost::exception_ptr eptr, const Array::Ptr& result, Array::Ptr& resultOut)
{
if (eptr) {
try {
std::rethrow_exception(eptr);
boost::rethrow_exception(eptr);
} catch (const std::exception& ex) {
Log(LogCritical, "ConsoleCommand")
<< "HTTP query failed: " << ex.what();

View File

@ -54,10 +54,10 @@ private:
mutable boost::condition_variable m_CV;
static void ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, std::exception_ptr eptr, const Value& result, Value& resultOut,
std::exception_ptr& eptrOut);
bool& ready, boost::exception_ptr eptr, const Value& result, Value& resultOut,
boost::exception_ptr& eptrOut);
static void AutocompleteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, std::exception_ptr eptr, const Array::Ptr& result, Array::Ptr& resultOut);
bool& ready, boost::exception_ptr eptr, const Array::Ptr& result, Array::Ptr& resultOut);
#ifdef HAVE_EDITLINE
static char *ConsoleCompleteHelper(const char *word, int state);

View File

@ -28,6 +28,8 @@
#include "base/exception.hpp"
#include "base/scriptglobal.hpp"
#include "base/loader.hpp"
#include <boost/exception_ptr.hpp>
#include <boost/exception/errinfo_nested_exception.hpp>
using namespace icinga;
@ -70,7 +72,8 @@ ExpressionResult Expression::Evaluate(ScriptFrame& frame, DebugHint *dhint) cons
} catch (const std::exception& ex) {
frame.DecreaseStackDepth();
BOOST_THROW_EXCEPTION(ScriptError("Error while evaluating expression: " + String(ex.what()), GetDebugInfo()));
BOOST_THROW_EXCEPTION(ScriptError("Error while evaluating expression: " + String(ex.what()), GetDebugInfo())
<< boost::errinfo_nested_exception(boost::current_exception()));
}
frame.DecreaseStackDepth();

View File

@ -105,7 +105,7 @@ void IdoMysqlConnection::Pause(void)
m_QueryQueue.Join();
}
void IdoMysqlConnection::ExceptionHandler(std::exception_ptr exp)
void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
{
Log(LogCritical, "IdoMysqlConnection", "Exception during database operation: Verify that your database is operational!");

View File

@ -117,7 +117,7 @@ private:
void ClearTableBySession(const String& table);
void ClearTablesBySession(void);
void ExceptionHandler(std::exception_ptr exp);
void ExceptionHandler(boost::exception_ptr exp);
void FinishConnect(double startTime);
};

View File

@ -109,7 +109,7 @@ void IdoPgsqlConnection::Pause(void)
m_QueryQueue.Join();
}
void IdoPgsqlConnection::ExceptionHandler(std::exception_ptr exp)
void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp)
{
Log(LogWarning, "IdoPgsqlConnection", "Exception during database operation: Verify that your database is operational!");

View File

@ -102,7 +102,7 @@ private:
void ClearTableBySession(const String& table);
void ClearTablesBySession(void);
void ExceptionHandler(std::exception_ptr exp);
void ExceptionHandler(boost::exception_ptr exp);
void FinishConnect(double startTime);
};

View File

@ -53,7 +53,7 @@ void ApiClient::GetTypes(const TypesCompletionCallback& callback) const
req->AddHeader("Accept", "application/json");
m_Connection->SubmitRequest(req, boost::bind(TypesHttpCompletionCallback, _1, _2, callback));
} catch (const std::exception& ex) {
callback(std::current_exception(), std::vector<ApiType::Ptr>());
callback(boost::current_exception(), std::vector<ApiType::Ptr>());
}
}
@ -94,11 +94,11 @@ void ApiClient::TypesHttpCompletionCallback(HttpRequest& request, HttpResponse&
types.push_back(type);
}
callback(std::exception_ptr(), types);
callback(boost::exception_ptr(), types);
} catch (const std::exception& ex) {
Log(LogCritical, "ApiClient")
<< "Error while decoding response: " << DiagnosticInformation(ex);
callback(std::current_exception(), std::vector<ApiType::Ptr>());
callback(boost::current_exception(), std::vector<ApiType::Ptr>());
}
}
@ -143,7 +143,7 @@ void ApiClient::GetObjects(const String& pluralType, const ObjectsCompletionCall
req->AddHeader("Accept", "application/json");
m_Connection->SubmitRequest(req, boost::bind(ObjectsHttpCompletionCallback, _1, _2, callback));
} catch (const std::exception& ex) {
callback(std::current_exception(), std::vector<ApiObject::Ptr>());
callback(boost::current_exception(), std::vector<ApiObject::Ptr>());
}
}
@ -221,11 +221,11 @@ void ApiClient::ObjectsHttpCompletionCallback(HttpRequest& request,
}
}
callback(std::exception_ptr(), objects);
callback(boost::exception_ptr(), objects);
} catch (const std::exception& ex) {
Log(LogCritical, "ApiClient")
<< "Error while decoding response: " << DiagnosticInformation(ex);
callback(std::current_exception(), std::vector<ApiObject::Ptr>());
callback(boost::current_exception(), std::vector<ApiObject::Ptr>());
}
}
@ -257,7 +257,7 @@ void ApiClient::ExecuteScript(const String& session, const String& command, bool
req->AddHeader("Accept", "application/json");
m_Connection->SubmitRequest(req, boost::bind(ExecuteScriptHttpCompletionCallback, _1, _2, callback));
} catch (const std::exception& ex) {
callback(std::current_exception(), Empty);
callback(boost::current_exception(), Empty);
}
}
@ -307,9 +307,9 @@ void ApiClient::ExecuteScriptHttpCompletionCallback(HttpRequest& request,
}
}
callback(std::exception_ptr(), result);
callback(boost::exception_ptr(), result);
} catch (const std::exception& ex) {
callback(std::current_exception(), Empty);
callback(boost::current_exception(), Empty);
}
}
@ -341,7 +341,7 @@ void ApiClient::AutocompleteScript(const String& session, const String& command,
req->AddHeader("Accept", "application/json");
m_Connection->SubmitRequest(req, boost::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback));
} catch (const std::exception& ex) {
callback(std::current_exception(), Array::Ptr());
callback(boost::current_exception(), Array::Ptr());
}
}
@ -380,8 +380,8 @@ void ApiClient::AutocompleteScriptHttpCompletionCallback(HttpRequest& request,
BOOST_THROW_EXCEPTION(ScriptError(errorMessage));
}
callback(std::exception_ptr(), suggestions);
callback(boost::exception_ptr(), suggestions);
} catch (const std::exception& ex) {
callback(std::current_exception(), Array::Ptr());
callback(boost::current_exception(), Array::Ptr());
}
}

View File

@ -92,20 +92,20 @@ public:
ApiClient(const String& host, const String& port,
const String& user, const String& password);
typedef boost::function<void(std::exception_ptr, const std::vector<ApiType::Ptr>&)> TypesCompletionCallback;
typedef boost::function<void(boost::exception_ptr, const std::vector<ApiType::Ptr>&)> TypesCompletionCallback;
void GetTypes(const TypesCompletionCallback& callback) const;
typedef boost::function<void(std::exception_ptr, const std::vector<ApiObject::Ptr>&)> ObjectsCompletionCallback;
typedef boost::function<void(boost::exception_ptr, const std::vector<ApiObject::Ptr>&)> ObjectsCompletionCallback;
void GetObjects(const String& pluralType, const ObjectsCompletionCallback& callback,
const std::vector<String>& names = std::vector<String>(),
const std::vector<String>& attrs = std::vector<String>(),
const std::vector<String>& joins = std::vector<String>(), bool all_joins = false) const;
typedef boost::function<void(std::exception_ptr, const Value&)> ExecuteScriptCompletionCallback;
typedef boost::function<void(boost::exception_ptr, const Value&)> ExecuteScriptCompletionCallback;
void ExecuteScript(const String& session, const String& command, bool sandboxed,
const ExecuteScriptCompletionCallback& callback) const;
typedef boost::function<void(std::exception_ptr, const Array::Ptr&)> AutocompleteScriptCompletionCallback;
typedef boost::function<void(boost::exception_ptr, const Array::Ptr&)> AutocompleteScriptCompletionCallback;
void AutocompleteScript(const String& session, const String& command, bool sandboxed,
const AutocompleteScriptCompletionCallback& callback) const;

View File

@ -143,7 +143,7 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
<< boost::errinfo_file_name(path));
}
for (const std::exception_ptr& ex : upq.GetExceptions()) {
for (const boost::exception_ptr& ex : upq.GetExceptions()) {
errors->Add(DiagnosticInformation(ex));
}
}