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));
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);
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));
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);
}
}
-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));
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);
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);
};
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;
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);
}
#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>
}
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:
#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;
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)
* 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);
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)
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
#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
{
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);
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:
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);
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,
}
if (eptr)
- std::rethrow_exception(eptr);
+ boost::rethrow_exception(eptr);
}
if (commandOnce.IsEmpty()) {
}
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();
}
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();
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);
#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;
} 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();
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!");
void ClearTableBySession(const String& table);
void ClearTablesBySession(void);
- void ExceptionHandler(std::exception_ptr exp);
+ void ExceptionHandler(boost::exception_ptr exp);
void FinishConnect(double startTime);
};
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!");
void ClearTableBySession(const String& table);
void ClearTablesBySession(void);
- void ExceptionHandler(std::exception_ptr exp);
+ void ExceptionHandler(boost::exception_ptr exp);
void FinishConnect(double startTime);
};
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>());
}
}
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>());
}
}
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>());
}
}
}
}
- 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>());
}
}
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);
}
}
}
}
- 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);
}
}
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());
}
}
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());
}
}
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;
<< 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));
}
}