]> granicus.if.org Git - icinga2/commitdiff
Use BOOST_THROW_EXCEPTION instead of boost::throw_exception()
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 6 Feb 2013 11:51:12 +0000 (12:51 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 6 Feb 2013 11:51:12 +0000 (12:51 +0100)
Fixes #3636

43 files changed:
components/checker/checkercomponent.cpp
components/compat/compatcomponent.cpp
components/replication/replicationcomponent.cpp
icinga-app/icinga.cpp
lib/base/application.cpp
lib/base/asynctask.h
lib/base/component.cpp
lib/base/dictionary.cpp
lib/base/dynamicobject.cpp
lib/base/dynamictype.cpp
lib/base/fifo.cpp
lib/base/i2-base.h
lib/base/logger.cpp
lib/base/netstring.cpp
lib/base/object.cpp
lib/base/process.cpp
lib/base/socket.cpp
lib/base/streamlogger.cpp
lib/base/tcpsocket.cpp
lib/base/tlsstream.cpp
lib/base/unixsocket.cpp
lib/base/utility.cpp
lib/base/value.cpp
lib/base/value.h
lib/config/config_parser.cc
lib/config/config_parser.yy
lib/config/configcompiler.cpp
lib/config/configitem.cpp
lib/config/configitembuilder.cpp
lib/config/configtype.cpp
lib/config/expression.cpp
lib/icinga/externalcommandprocessor.cpp
lib/icinga/host.cpp
lib/icinga/hostgroup.cpp
lib/icinga/macroprocessor.cpp
lib/icinga/nullchecktask.cpp
lib/icinga/pluginchecktask.cpp
lib/icinga/service.cpp
lib/icinga/servicegroup.cpp
lib/icinga/timeperiod.cpp
lib/remoting/endpoint.cpp
lib/remoting/endpointmanager.cpp
lib/remoting/jsonrpcconnection.cpp

index be154436d01818e2d81d10fa243a3097f4a0f6d3..af6e83a4bac9c1d48c94968e14a44c94c1e5ba5b 100644 (file)
@@ -108,7 +108,7 @@ void CheckerComponent::CheckTimerHandler(void)
                try {
                        service->BeginExecuteCheck(boost::bind(&CheckerComponent::CheckCompletedHandler, this, service));
                } catch (const exception& ex) {
-                       Logger::Write(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + ex.what());
+                       Logger::Write(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + diagnostic_information(ex));
                }
 
                tasks++;
index fa4aa1b2cc673cb054e1c749fbf635d161e11405..2ded037a3a78892256c58d117c8fcdeedbd4712c 100644 (file)
@@ -104,25 +104,25 @@ void CompatComponent::CommandPipeThread(const String& commandPath)
                        fifo_ok = true;
                } else {
                        if (unlink(commandPath.CStr()) < 0)
-                               throw_exception(PosixException("unlink() failed", errno));
+                               BOOST_THROW_EXCEPTION(PosixException("unlink() failed", errno));
                }
        }
 
 
        if (!fifo_ok && mkfifo(commandPath.CStr(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) < 0)
-               throw_exception(PosixException("mkfifo() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("mkfifo() failed", errno));
 
        for (;;) {
                int fd = open(commandPath.CStr(), O_RDONLY);
 
                if (fd < 0)
-                       throw_exception(PosixException("open() failed", errno));
+                       BOOST_THROW_EXCEPTION(PosixException("open() failed", errno));
 
                FILE *fp = fdopen(fd, "r");
 
                if (fp == NULL) {
                        close(fd);
-                       throw_exception(PosixException("fdopen() failed", errno));
+                       BOOST_THROW_EXCEPTION(PosixException("fdopen() failed", errno));
                }
 
                char line[2048];
@@ -149,7 +149,7 @@ void CompatComponent::ProcessCommand(const String& command)
                ExternalCommandProcessor::Execute(command);
        } catch (const exception& ex) {
                stringstream msgbuf;
-               msgbuf << "External command failed: " << ex.what();
+               msgbuf << "External command failed: " << diagnostic_information(ex);
                Logger::Write(LogWarning, "compat", msgbuf.str());
        }
 }
@@ -503,11 +503,11 @@ void CompatComponent::StatusTimerHandler(void)
 
        statusfp.close();
        if (rename(statuspathtmp.CStr(), statuspath.CStr()) < 0)
-               throw_exception(PosixException("rename() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("rename() failed", errno));
 
        objectfp.close();
        if (rename(objectspathtmp.CStr(), objectspath.CStr()) < 0)
-               throw_exception(PosixException("rename() failed", errno));      
+               BOOST_THROW_EXCEPTION(PosixException("rename() failed", errno));        
 }
 
 EXPORT_COMPONENT(compat, CompatComponent);
index f8cfec823adde9f589d74517e0136c0a7d615151..fee1d2a9635a03d59497796ee5a2d517c7b1b7f6 100644 (file)
@@ -217,7 +217,7 @@ void ReplicationComponent::RemoteObjectUpdateHandler(const RequestMessage& reque
                object->Register();
        } else {
                if (object->IsLocal())
-                       throw_exception(invalid_argument("Replicated remote object is marked as local."));
+                       BOOST_THROW_EXCEPTION(invalid_argument("Replicated remote object is marked as local."));
 
                // TODO: disallow config updates depending on endpoint config
 
index d22ec6ead26eb9b18779cda4f267278b3dfc931c..b12f8a1177adc226c45b4d8ece2948597b8f8de3 100644 (file)
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
        Application::Ptr app = Application::GetInstance();
 
        if (!app)
-               throw_exception(runtime_error("Configuration must create an Application object."));
+               BOOST_THROW_EXCEPTION(runtime_error("Configuration must create an Application object."));
 
        if (g_AppParams.count("daemonize")) {
                Logger::Write(LogInformation, "icinga", "Daemonizing.");
index 31d87abd054fdab0649d88d97807737656e24acb..dcc4e5a7009f7c4bae0e0c59f08956f6888205cc 100644 (file)
@@ -37,7 +37,7 @@ Application::Application(const Dictionary::Ptr& serializedUpdate)
        : DynamicObject(serializedUpdate), m_PidFile(NULL)
 {
        if (!IsLocal())
-               throw_exception(runtime_error("Application objects must be local."));
+               BOOST_THROW_EXCEPTION(runtime_error("Application objects must be local."));
 
 #ifdef _WIN32
        /* disable GUI-based error messages for LoadLibrary() */
@@ -45,7 +45,7 @@ Application::Application(const Dictionary::Ptr& serializedUpdate)
 
        WSADATA wsaData;
        if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
-               throw_exception(Win32Exception("WSAStartup failed", WSAGetLastError()));
+               BOOST_THROW_EXCEPTION(Win32Exception("WSAStartup failed", WSAGetLastError()));
 #endif /* _WIN32 */
 
        char *debugging = getenv("_DEBUG");
@@ -205,7 +205,7 @@ String Application::GetExePath(const String& argv0)
 #ifndef _WIN32
        char buffer[MAXPATHLEN];
        if (getcwd(buffer, sizeof(buffer)) == NULL)
-               throw_exception(PosixException("getcwd failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("getcwd failed", errno));
        String workingDirectory = buffer;
 
        if (argv0[0] != '/')
@@ -240,20 +240,20 @@ String Application::GetExePath(const String& argv0)
 
                        if (!foundPath) {
                                executablePath.Clear();
-                               throw_exception(runtime_error("Could not determine executable path."));
+                               BOOST_THROW_EXCEPTION(runtime_error("Could not determine executable path."));
                        }
                }
        }
 
        if (realpath(executablePath.CStr(), buffer) == NULL)
-               throw_exception(PosixException("realpath failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("realpath failed", errno));
 
        return buffer;
 #else /* _WIN32 */
        char FullExePath[MAXPATHLEN];
 
        if (!GetModuleFileName(NULL, FullExePath, sizeof(FullExePath)))
-               throw_exception(Win32Exception("GetModuleFileName() failed", GetLastError()));
+               BOOST_THROW_EXCEPTION(Win32Exception("GetModuleFileName() failed", GetLastError()));
 
        return FullExePath;
 #endif /* _WIN32 */
@@ -375,12 +375,8 @@ void Application::ExceptionHandler(void)
        try {
                throw;
        } catch (const std::exception& ex) {
-               std::cerr << std::endl;
-               std::cerr << "Unhandled exception of type "
-                         << Utility::GetTypeName(typeid(ex))
-                         << std::endl;
-               std::cerr << "Diagnostic Information: "
-                         << ex.what()
+               std::cerr << std::endl
+                         << diagnostic_information(ex)
                          << std::endl;
        }
 
@@ -460,7 +456,7 @@ void Application::UpdatePidFile(const String& filename)
        m_PidFile = fopen(filename.CStr(), "w");
 
        if (m_PidFile == NULL)
-               throw_exception(runtime_error("Could not open PID file '" + filename + "'"));
+               BOOST_THROW_EXCEPTION(runtime_error("Could not open PID file '" + filename + "'"));
 
 #ifndef _WIN32
        if (flock(fileno(m_PidFile), LOCK_EX | LOCK_NB) < 0) {
index 503fcf48ada7da62ee8bb414937764744a266dc3..ca0f8b3d668f3856a3ecc1a72ffad80d54bd617e 100644 (file)
@@ -91,10 +91,10 @@ public:
        TResult GetResult(void)
        {
                if (!m_Finished)
-                       throw_exception(runtime_error("GetResult called on an unfinished AsyncTask"));
+                       BOOST_THROW_EXCEPTION(runtime_error("GetResult called on an unfinished AsyncTask"));
 
                if (m_ResultRetrieved)
-                       throw_exception(runtime_error("GetResult called on an AsyncTask whose result was already retrieved."));
+                       BOOST_THROW_EXCEPTION(runtime_error("GetResult called on an AsyncTask whose result was already retrieved."));
 
                m_ResultRetrieved = true;
 
index 928cca446a3f915ff0b56a48a139b9ebe70e1c5c..f60ed4f6c5608ee0b59ba4b1a6b2adecff7e5937 100644 (file)
@@ -32,7 +32,7 @@ Component::Component(const Dictionary::Ptr& properties)
        assert(Application::IsMainThread());
 
        if (!IsLocal())
-               throw_exception(runtime_error("Component objects must be local."));
+               BOOST_THROW_EXCEPTION(runtime_error("Component objects must be local."));
 
 #ifdef _WIN32
        HMODULE
@@ -63,14 +63,14 @@ Component::Component(const Dictionary::Ptr& properties)
 
        try {
                if (pCreateComponent == NULL)
-                       throw_exception(runtime_error("Loadable module does not contain "
+                       BOOST_THROW_EXCEPTION(runtime_error("Loadable module does not contain "
                            "CreateComponent function"));
 
                /* pCreateComponent returns a raw pointer which we must wrap in a shared_ptr */
                impl = IComponent::Ptr(pCreateComponent());
 
                if (!impl)
-                       throw_exception(runtime_error("CreateComponent function returned NULL."));
+                       BOOST_THROW_EXCEPTION(runtime_error("CreateComponent function returned NULL."));
        } catch (...) {
 #ifdef _WIN32
                FreeLibrary(hModule);
index 9306b3fbc92fef6af363f20970a2b06cd94ab4f4..78dbadaa26f43906ae2993fea380b4bd41e6abd4 100644 (file)
@@ -223,7 +223,7 @@ Dictionary::Ptr Dictionary::FromJson(cJSON *json)
        Dictionary::Ptr dictionary = boost::make_shared<Dictionary>();
 
        if (json->type != cJSON_Object)
-               throw_exception(invalid_argument("JSON type must be cJSON_Object."));
+               BOOST_THROW_EXCEPTION(invalid_argument("JSON type must be cJSON_Object."));
 
        for (cJSON *i = json->child; i != NULL; i = i->next) {
                dictionary->Set(i->string, Value::FromJson(i));
index f4f9e765f9c3374e110dfccd8e916adddafa997e..71f8124032723c658c7a14a3aff5f148812a51fc 100644 (file)
@@ -39,7 +39,7 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
        RegisterAttribute("methods", Attribute_Config);
 
        if (!serializedObject->Contains("configTx"))
-               throw_exception(invalid_argument("Serialized object must contain a config snapshot."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Serialized object must contain a config snapshot."));
 
        /* apply config state from the config item/remote update;
         * The DynamicObject::Create function takes care of restoring
@@ -173,7 +173,7 @@ void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
        Value oldValue;
 
        if (!allowEditConfig && (tt.first->second.Type & Attribute_Config))
-               throw_exception(runtime_error("Config properties are immutable: '" + name + "'."));
+               BOOST_THROW_EXCEPTION(runtime_error("Config properties are immutable: '" + name + "'."));
 
        if (!tt.second && tx >= tt.first->second.Tx) {
                oldValue = tt.first->second.Data;
@@ -312,7 +312,7 @@ ScriptTask::Ptr DynamicObject::InvokeMethod(const String& method,
        ScriptFunction::Ptr func = ScriptFunction::GetByName(funcName);
 
        if (!func)
-               throw_exception(invalid_argument("Function '" + funcName + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Function '" + funcName + "' does not exist."));
 
        ScriptTask::Ptr task = boost::make_shared<ScriptTask>(func, arguments);
        task->Start(callback);
@@ -330,7 +330,7 @@ void DynamicObject::DumpObjects(const String& filename)
        fp.open(tempFilename.CStr(), std::ios_base::out);
 
        if (!fp)
-               throw_exception(runtime_error("Could not open '" + filename + "' file"));
+               BOOST_THROW_EXCEPTION(runtime_error("Could not open '" + filename + "' file"));
 
        StdioStream::Ptr sfp = boost::make_shared<StdioStream>(&fp, false);
        sfp->Start();
@@ -377,7 +377,7 @@ void DynamicObject::DumpObjects(const String& filename)
 #endif /* _WIN32 */
 
        if (rename(tempFilename.CStr(), filename.CStr()) < 0)
-               throw_exception(PosixException("rename() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("rename() failed", errno));
 }
 
 void DynamicObject::RestoreObjects(const String& filename)
@@ -405,7 +405,7 @@ void DynamicObject::RestoreObjects(const String& filename)
                DynamicType::Ptr dt = DynamicType::GetByName(type);
 
                if (!dt)
-                       throw_exception(invalid_argument("Invalid type: " + type));
+                       BOOST_THROW_EXCEPTION(invalid_argument("Invalid type: " + type));
 
                DynamicObject::Ptr object = dt->GetObject(name);
 
index 08328858921f426da4d4fc7cc83e8ac64be39a9b..05efe7b5a6bdd0a389701329322909e27eb9cb24 100644 (file)
@@ -74,7 +74,7 @@ DynamicObject::Ptr DynamicType::GetObject(const String& name) const
 void DynamicType::RegisterType(const DynamicType::Ptr& type)
 {
        if (GetByName(type->GetName()))
-               throw_exception(runtime_error("Cannot register class for type '" +
+               BOOST_THROW_EXCEPTION(runtime_error("Cannot register class for type '" +
                    type->GetName() + "': Objects of this type already exist."));
 
        GetTypes()[type->GetName()] = type;
index 6af65b8f25fc87830dc529c60037e321fa13d165..33701d32314f176af45b7f45bf41e0080fc03aa7 100644 (file)
@@ -60,7 +60,7 @@ void FIFO::ResizeBuffer(size_t newSize)
        char *newBuffer = static_cast<char *>(realloc(m_Buffer, newSize));
 
        if (newBuffer == NULL)
-               throw_exception(bad_alloc());
+               BOOST_THROW_EXCEPTION(bad_alloc());
 
        m_Buffer = newBuffer;
 
index c48b007aeb15e68ded903d1ddc8fac0e3b80c57a..66ee13c82aee4d5e826a0b6ad9c522f03683bd91 100644 (file)
@@ -138,6 +138,7 @@ using std::type_info;
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
 #include <boost/program_options.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 using boost::shared_ptr;
 using boost::weak_ptr;
@@ -151,9 +152,9 @@ using boost::condition_variable;
 using boost::system_time;
 using boost::posix_time::millisec;
 using boost::tie;
-using boost::throw_exception;
 using boost::rethrow_exception;
 using boost::current_exception;
+using boost::diagnostic_information;
 
 namespace tuples = boost::tuples;
 
index 95af4c214f9fa3d3d1d66e548553a001a47b88d2..95f7ebc0f8356f616c938f8ce522751f989dcfc3 100644 (file)
@@ -32,11 +32,11 @@ Logger::Logger(const Dictionary::Ptr& properties)
        : DynamicObject(properties)
 {
        if (!IsLocal())
-               throw_exception(runtime_error("Logger objects must be local."));
+               BOOST_THROW_EXCEPTION(runtime_error("Logger objects must be local."));
 
        String type = Get("type");
        if (type.IsEmpty())
-               throw_exception(runtime_error("Logger objects must have a 'type' property."));
+               BOOST_THROW_EXCEPTION(runtime_error("Logger objects must have a 'type' property."));
 
        ILogger::Ptr impl;
 
@@ -44,12 +44,12 @@ Logger::Logger(const Dictionary::Ptr& properties)
 #ifndef _WIN32
                impl = boost::make_shared<SyslogLogger>();
 #else /* _WIN32 */
-               throw_exception(invalid_argument("Syslog is not supported on Windows."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Syslog is not supported on Windows."));
 #endif /* _WIN32 */
        } else if (type == "file") {
                String path = Get("path");
                if (path.IsEmpty())
-                       throw_exception(invalid_argument("'log' object of type 'file' must have a 'path' property"));
+                       BOOST_THROW_EXCEPTION(invalid_argument("'log' object of type 'file' must have a 'path' property"));
 
                StreamLogger::Ptr slogger = boost::make_shared<StreamLogger>();
                slogger->OpenFile(path);
@@ -58,7 +58,7 @@ Logger::Logger(const Dictionary::Ptr& properties)
        } else if (type == "console") {
                impl = boost::make_shared<StreamLogger>(&std::cout);
        } else {
-               throw_exception(runtime_error("Unknown log type: " + type));
+               BOOST_THROW_EXCEPTION(runtime_error("Unknown log type: " + type));
        }
 
        impl->m_Config = this;
@@ -150,7 +150,7 @@ String Logger::SeverityToString(LogSeverity severity)
                case LogCritical:
                        return "critical";
                default:
-                       throw_exception(invalid_argument("Invalid severity."));
+                       BOOST_THROW_EXCEPTION(invalid_argument("Invalid severity."));
        }
 }
 
@@ -170,7 +170,7 @@ LogSeverity Logger::StringToSeverity(const String& severity)
        else if (severity == "critical")
                return LogCritical;
        else
-               throw_exception(invalid_argument("Invalid severity: " + severity));
+               BOOST_THROW_EXCEPTION(invalid_argument("Invalid severity: " + severity));
 }
 
 /**
index c3264d178f54f66f0516e0e75e6b9718f4306dc3..692c7754ef0c9518b37306447aaa57f01ae8153a 100644 (file)
@@ -37,7 +37,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
        char *buffer = static_cast<char *>(malloc(buffer_length));
 
        if (buffer == NULL)
-               throw_exception(bad_alloc());
+               BOOST_THROW_EXCEPTION(bad_alloc());
 
        peek_length = stream->Peek(buffer, buffer_length);
 
@@ -50,7 +50,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
        /* no leading zeros allowed */
        if (buffer[0] == '0' && isdigit(buffer[1])) {
                free(buffer);
-               throw_exception(invalid_argument("Invalid netString (leading zero)"));
+               BOOST_THROW_EXCEPTION(invalid_argument("Invalid netString (leading zero)"));
        }
 
        size_t len, i;
@@ -60,7 +60,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
                /* length specifier must have at most 9 characters */
                if (i >= 9) {
                        free(buffer);
-                       throw_exception(invalid_argument("Length specifier must not exceed 9 characters"));
+                       BOOST_THROW_EXCEPTION(invalid_argument("Length specifier must not exceed 9 characters"));
                }
 
                len = len * 10 + (buffer[i] - '0');
@@ -73,7 +73,7 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
 
        if (new_buffer == NULL) {
                free(buffer);
-               throw_exception(bad_alloc());
+               BOOST_THROW_EXCEPTION(bad_alloc());
        }
 
        buffer = new_buffer;
@@ -86,13 +86,13 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
        /* check for the colon delimiter */
        if (buffer[i] != ':') {
                free(buffer);
-               throw_exception(invalid_argument("Invalid NetString (missing :)"));
+               BOOST_THROW_EXCEPTION(invalid_argument("Invalid NetString (missing :)"));
        }
 
        /* check for the comma delimiter after the String */
        if (buffer[i + 1 + len] != ',') {
                free(buffer);
-               throw_exception(invalid_argument("Invalid NetString (missing ,)"));
+               BOOST_THROW_EXCEPTION(invalid_argument("Invalid NetString (missing ,)"));
        }
 
        *str = String(&buffer[i + 1], &buffer[i + 1 + len]);
index 5e7486b49a20f8458c08da365d41b440f5e86495..041c5418e5019253440387623e6e13b221f6914e 100644 (file)
@@ -116,7 +116,7 @@ void Object::PrintMemoryProfile(void)
 
        dictfp.close();
        if (rename("dictionaries.dump.tmp", "dictionaries.dump") < 0)
-               throw_exception(PosixException("rename() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("rename() failed", errno));
 
        String type;
        int count;
index 63c24117ee31e510807cd9c78518aeb239cdabc3..1f76f3832d598d78f4cc7c47ad0074ef443759bc 100644 (file)
@@ -152,7 +152,7 @@ void Process::InitTask(void)
 #endif /* _MSC_VER */
 
        if (m_FP == NULL)
-               throw_exception(runtime_error("Could not create process."));
+               BOOST_THROW_EXCEPTION(runtime_error("Could not create process."));
 }
 
 bool Process::RunTask(void)
index e73582cb6a79d7b7f63f71db5b8644291cba4af9..8e59b3b80e510e63c91c4a9d6e8015c53227bf51 100644 (file)
@@ -74,10 +74,10 @@ void Socket::SetFD(SOCKET fd)
                int flags;
                flags = fcntl(fd, F_GETFL, 0);
                if (flags < 0)
-                       throw_exception(PosixException("fcntl failed", errno));
+                       BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
                if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
-                       throw_exception(PosixException("fcntl failed", errno));
+                       BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 #else /* F_GETFL */
                unsigned long lTrue = 1;
                ioctlsocket(fd, FIONBIO, &lTrue);
@@ -154,7 +154,7 @@ int Socket::GetLastSocketError(void)
  */
 void Socket::HandleException(void)
 {
-       throw_exception(SocketException("select() returned fd in except fdset", GetError()));
+       BOOST_THROW_EXCEPTION(SocketException("select() returned fd in except fdset", GetError()));
 }
 
 /**
@@ -169,7 +169,7 @@ String Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len)
 
        if (getnameinfo(address, len, host, sizeof(host), service,
            sizeof(service), NI_NUMERICHOST | NI_NUMERICSERV) < 0)
-               throw_exception(SocketException("getnameinfo() failed",
+               BOOST_THROW_EXCEPTION(SocketException("getnameinfo() failed",
                    GetLastSocketError()));
 
        stringstream s;
@@ -190,7 +190,7 @@ String Socket::GetClientAddress(void)
        socklen_t len = sizeof(sin);
 
        if (getsockname(GetFD(), (sockaddr *)&sin, &len) < 0)
-               throw_exception(SocketException("getsockname() failed", GetError()));
+               BOOST_THROW_EXCEPTION(SocketException("getsockname() failed", GetError()));
 
        return GetAddressFromSockaddr((sockaddr *)&sin, len);
 }
@@ -208,7 +208,7 @@ String Socket::GetPeerAddress(void)
        socklen_t len = sizeof(sin);
 
        if (getpeername(GetFD(), (sockaddr *)&sin, &len) < 0)
-               throw_exception(SocketException("getpeername() failed", GetError()));
+               BOOST_THROW_EXCEPTION(SocketException("getpeername() failed", GetError()));
 
        return GetAddressFromSockaddr((sockaddr *)&sin, len);
 }
@@ -269,7 +269,7 @@ void Socket::ReadThreadProc(void)
 
                try {
                        if (rc < 0)
-                               throw_exception(SocketException("select() failed", GetError()));
+                               BOOST_THROW_EXCEPTION(SocketException("select() failed", GetError()));
 
                        if (FD_ISSET(fd, &readfds))
                                HandleReadable();
@@ -327,7 +327,7 @@ void Socket::WriteThreadProc(void)
 
                try {
                        if (rc < 0)
-                               throw_exception(SocketException("select() failed", GetError()));
+                               BOOST_THROW_EXCEPTION(SocketException("select() failed", GetError()));
 
                        if (FD_ISSET(fd, &writefds))
                                HandleWritable();
@@ -446,7 +446,7 @@ void Socket::Write(const void *buffer, size_t size)
 void Socket::Listen(void)
 {
        if (listen(GetFD(), SOMAXCONN) < 0)
-               throw_exception(SocketException("listen() failed", GetError()));
+               BOOST_THROW_EXCEPTION(SocketException("listen() failed", GetError()));
 
        m_Listening = true;
 }
@@ -497,7 +497,7 @@ void Socket::HandleWritableClient(void)
                rc = send(GetFD(), data, count, 0);
 
                if (rc <= 0)
-                       throw_exception(SocketException("send() failed", GetError()));
+                       BOOST_THROW_EXCEPTION(SocketException("send() failed", GetError()));
 
                {
                        boost::mutex::scoped_lock lock(m_QueueMutex);
@@ -528,7 +528,7 @@ void Socket::HandleReadableClient(void)
                        break;
 
                if (rc <= 0)
-                       throw_exception(SocketException("recv() failed", GetError()));
+                       BOOST_THROW_EXCEPTION(SocketException("recv() failed", GetError()));
 
                {
                        boost::mutex::scoped_lock lock(m_QueueMutex);
@@ -561,7 +561,7 @@ void Socket::HandleReadableServer(void)
        fd = accept(GetFD(), (sockaddr *)&addr, &addrlen);
 
        if (fd < 0)
-               throw_exception(SocketException("accept() failed", GetError()));
+               BOOST_THROW_EXCEPTION(SocketException("accept() failed", GetError()));
 
        TcpSocket::Ptr client = boost::make_shared<TcpSocket>();
        client->SetFD(fd);
index 89508dcfeec0442659475d7dad968e43d6fb556a..28042fdfb698c7f218419b964fb8ba28cf2a75bb 100644 (file)
@@ -54,7 +54,7 @@ void StreamLogger::OpenFile(const String& filename)
                stream->open(filename.CStr(), fstream::out | fstream::trunc);
 
                if (!stream->good())
-                       throw_exception(runtime_error("Could not open logfile '" + filename + "'"));
+                       BOOST_THROW_EXCEPTION(runtime_error("Could not open logfile '" + filename + "'"));
        } catch (...) {
                delete stream;
                throw;
index c42499211e456f77b062e005b03f7503a9b23548..a235ce6c6d97c897516a79f543364b08ee6c6981 100644 (file)
@@ -52,7 +52,7 @@ void TcpSocket::Bind(String node, String service, int family)
 
        if (getaddrinfo(node.IsEmpty() ? NULL : node.CStr(),
            service.CStr(), &hints, &result) < 0)
-               throw_exception(SocketException("getaddrinfo() failed", GetLastSocketError()));
+               BOOST_THROW_EXCEPTION(SocketException("getaddrinfo() failed", GetLastSocketError()));
 
        int fd = INVALID_SOCKET;
 
@@ -91,7 +91,7 @@ void TcpSocket::Bind(String node, String service, int family)
        freeaddrinfo(result);
 
        if (fd == INVALID_SOCKET)
-               throw_exception(runtime_error("Could not create a suitable socket."));
+               BOOST_THROW_EXCEPTION(runtime_error("Could not create a suitable socket."));
 }
 
 /**
@@ -113,7 +113,7 @@ void TcpSocket::Connect(const String& node, const String& service)
        int rc = getaddrinfo(node.CStr(), service.CStr(), &hints, &result);
 
        if (rc < 0)
-               throw_exception(SocketException("getaddrinfo() failed", GetLastSocketError()));
+               BOOST_THROW_EXCEPTION(SocketException("getaddrinfo() failed", GetLastSocketError()));
 
        int fd = INVALID_SOCKET;
 
@@ -149,5 +149,5 @@ void TcpSocket::Connect(const String& node, const String& service)
        freeaddrinfo(result);
 
        if (fd == INVALID_SOCKET)
-               throw_exception(runtime_error("Could not create a suitable socket."));
+               BOOST_THROW_EXCEPTION(runtime_error("Could not create a suitable socket."));
 }
index b8f46c771adcd4314a5b6d68284fb74329ed1b10..c3e16b5a6b038f956a913734832056c5df6e9e28 100644 (file)
@@ -47,10 +47,10 @@ void TlsStream::Start(void)
        m_SSLContext.reset();
 
        if (!m_SSL)
-               throw_exception(OpenSSLException("SSL_new failed", ERR_get_error()));
+               BOOST_THROW_EXCEPTION(OpenSSLException("SSL_new failed", ERR_get_error()));
 
        if (!GetClientCertificate())
-               throw_exception(logic_error("No X509 client certificate was specified."));
+               BOOST_THROW_EXCEPTION(logic_error("No X509 client certificate was specified."));
 
        if (!m_SSLIndexInitialized) {
                m_SSLIndex = SSL_get_ex_new_index(0, const_cast<char *>("TlsStream"), NULL, NULL, NULL);
@@ -142,7 +142,7 @@ void TlsStream::HandleIO(void)
                                        return;
                                default:
                                        I2Stream_check_exception(m_BIO);
-                                       throw_exception(OpenSSLException("SSL_do_handshake failed", ERR_get_error()));
+                                       BOOST_THROW_EXCEPTION(OpenSSLException("SSL_do_handshake failed", ERR_get_error()));
                        }
                }
        }
@@ -167,7 +167,7 @@ void TlsStream::HandleIO(void)
                                        return;
                                default:
                                        I2Stream_check_exception(m_BIO);
-                                       throw_exception(OpenSSLException("SSL_read failed", ERR_get_error()));
+                                       BOOST_THROW_EXCEPTION(OpenSSLException("SSL_read failed", ERR_get_error()));
                        }
                }
        }
@@ -201,7 +201,7 @@ void TlsStream::HandleIO(void)
                                        return;
                                default:
                                        I2Stream_check_exception(m_BIO);
-                                       throw_exception(OpenSSLException("SSL_write failed", ERR_get_error()));
+                                       BOOST_THROW_EXCEPTION(OpenSSLException("SSL_write failed", ERR_get_error()));
                        }
                }
        }
index 8cf7ea27770ab6b66c3fffaba479cc43c839ca3a..f8ad65d5ffef16c684403c7edf6b6a0dada2227d 100644 (file)
@@ -27,7 +27,7 @@ UnixSocket::UnixSocket(void)
        int fd = socket(AF_UNIX, SOCK_STREAM, PF_UNIX);
 
        if (fd < 0)
-               throw_exception(PosixException("socket() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("socket() failed", errno));
 
        SetFD(fd);
 }
@@ -43,7 +43,7 @@ void UnixSocket::Bind(const String& path)
        sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
 
        if (bind(GetFD(), (sockaddr *)&sun, SUN_LEN(&sun)) < 0)
-               throw_exception(PosixException("bind() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("bind() failed", errno));
 }
 
 void UnixSocket::Connect(const String& path)
@@ -55,6 +55,6 @@ void UnixSocket::Connect(const String& path)
        sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
 
        if (connect(GetFD(), (sockaddr *)&sun, SUN_LEN(&sun)) < 0 && errno != EINPROGRESS)
-               throw_exception(PosixException("connect() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("connect() failed", errno));
 }
 #endif /* _WIN32 */
index 615ee3a82c42d976a211cc42560d2a8edf46bd17..49707a7e1d8d701ea2b8316b326e751c0254649b 100644 (file)
@@ -121,7 +121,7 @@ void Utility::Daemonize(void) {
 
        pid = fork();
        if (pid < 0)
-               throw_exception(PosixException("fork() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("fork() failed", errno));
 
        if (pid)
                _exit(0);
@@ -129,7 +129,7 @@ void Utility::Daemonize(void) {
        fd = open("/dev/null", O_RDWR);
 
        if (fd < 0)
-               throw_exception(PosixException("open() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("open() failed", errno));
 
        if (fd != STDIN_FILENO)
                dup2(fd, STDIN_FILENO);
@@ -144,7 +144,7 @@ void Utility::Daemonize(void) {
                close(fd);
 
        if (setsid() < 0)
-               throw_exception(PosixException("setsid() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("setsid() failed", errno));
 #endif
 }
 
@@ -179,19 +179,19 @@ shared_ptr<SSL_CTX> Utility::MakeSSLContext(const String& pubkey, const String&
        SSL_CTX_set_mode(sslContext.get(), SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
 
        if (!SSL_CTX_use_certificate_chain_file(sslContext.get(), pubkey.CStr()))
-               throw_exception(OpenSSLException("Could not load public X509 key file", ERR_get_error()));
+               BOOST_THROW_EXCEPTION(OpenSSLException("Could not load public X509 key file", ERR_get_error()));
 
        if (!SSL_CTX_use_PrivateKey_file(sslContext.get(), privkey.CStr(), SSL_FILETYPE_PEM))
-               throw_exception(OpenSSLException("Could not load private X509 key file", ERR_get_error()));
+               BOOST_THROW_EXCEPTION(OpenSSLException("Could not load private X509 key file", ERR_get_error()));
 
        if (!SSL_CTX_load_verify_locations(sslContext.get(), cakey.CStr(), NULL))
-               throw_exception(OpenSSLException("Could not load public CA key file", ERR_get_error()));
+               BOOST_THROW_EXCEPTION(OpenSSLException("Could not load public CA key file", ERR_get_error()));
 
        STACK_OF(X509_NAME) *cert_names;
 
        cert_names = SSL_load_client_CA_file(cakey.CStr());
        if (cert_names == NULL)
-               throw_exception(OpenSSLException("SSL_load_client_CA_file() failed", ERR_get_error()));
+               BOOST_THROW_EXCEPTION(OpenSSLException("SSL_load_client_CA_file() failed", ERR_get_error()));
 
        SSL_CTX_set_client_CA_list(sslContext.get(), cert_names);
 
@@ -212,7 +212,7 @@ String Utility::GetCertificateCN(const shared_ptr<X509>& certificate)
            NID_commonName, buffer, sizeof(buffer));
 
        if (rc == -1)
-               throw_exception(OpenSSLException("X509 certificate has no CN"
+               BOOST_THROW_EXCEPTION(OpenSSLException("X509 certificate has no CN"
                    " attribute", ERR_get_error()));
 
        return buffer;
@@ -230,16 +230,16 @@ shared_ptr<X509> Utility::GetX509Certificate(const String& pemfile)
        BIO *fpcert = BIO_new(BIO_s_file());
 
        if (fpcert == NULL)
-               throw_exception(OpenSSLException("BIO_new failed",
+               BOOST_THROW_EXCEPTION(OpenSSLException("BIO_new failed",
                    ERR_get_error()));
 
        if (BIO_read_filename(fpcert, pemfile.CStr()) < 0)
-               throw_exception(OpenSSLException("BIO_read_filename failed",
+               BOOST_THROW_EXCEPTION(OpenSSLException("BIO_read_filename failed",
                    ERR_get_error()));
 
        cert = PEM_read_bio_X509_AUX(fpcert, NULL, NULL, NULL);
        if (cert == NULL)
-               throw_exception(OpenSSLException("PEM_read_bio_X509_AUX failed",
+               BOOST_THROW_EXCEPTION(OpenSSLException("PEM_read_bio_X509_AUX failed",
                    ERR_get_error()));
 
        BIO_free(fpcert);
@@ -271,14 +271,14 @@ String Utility::DirName(const String& path)
        String result;
 
        if (dir == NULL)
-               throw_exception(bad_alloc());
+               BOOST_THROW_EXCEPTION(bad_alloc());
 
 #ifndef _WIN32
        result = dirname(dir);
 #else /* _WIN32 */
        if (!PathRemoveFileSpec(dir)) {
                free(dir);
-               throw_exception(Win32Exception("PathRemoveFileSpec() failed",
+               BOOST_THROW_EXCEPTION(Win32Exception("PathRemoveFileSpec() failed",
                    GetLastError()));
        }
 
@@ -305,7 +305,7 @@ String Utility::BaseName(const String& path)
        String result;
 
        if (dir == NULL)
-               throw_exception(bad_alloc());
+               BOOST_THROW_EXCEPTION(bad_alloc());
 
 #ifndef _WIN32
        result = basename(dir);
@@ -356,7 +356,7 @@ double Utility::GetTime(void)
        struct timeval tv;
 
        if (gettimeofday(&tv, NULL) < 0)
-               throw_exception(PosixException("gettimeofday() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("gettimeofday() failed", errno));
 
        return tv.tv_sec + tv.tv_usec / 1000000.0;
 #endif /* _WIN32 */
@@ -418,12 +418,12 @@ Utility::LoadIcingaLibrary(const String& library, bool module)
        HMODULE hModule = LoadLibrary(path.CStr());
 
        if (hModule == NULL)
-               throw_exception(Win32Exception("LoadLibrary('" + path + "') failed", GetLastError()));
+               BOOST_THROW_EXCEPTION(Win32Exception("LoadLibrary('" + path + "') failed", GetLastError()));
 #else /* _WIN32 */
        lt_dlhandle hModule = lt_dlopen(path.CStr());
 
        if (hModule == NULL) {
-               throw_exception(runtime_error("Could not load library '" + path + "': " +  lt_dlerror()));
+               BOOST_THROW_EXCEPTION(runtime_error("Could not load library '" + path + "': " +  lt_dlerror()));
        }
 #endif /* _WIN32 */
 
@@ -460,7 +460,7 @@ bool Utility::Glob(const String& pathSpec, const function<void (const String&)>&
                if (errorCode == ERROR_FILE_NOT_FOUND)
                        return false;
 
-               throw_exception(Win32Exception("FindFirstFile() failed", errorCode));
+               BOOST_THROW_EXCEPTION(Win32Exception("FindFirstFile() failed", errorCode));
        }
 
        do {
@@ -468,7 +468,7 @@ bool Utility::Glob(const String& pathSpec, const function<void (const String&)>&
        } while (FindNextFile(handle, &wfd));
 
        if (!FindClose(handle))
-               throw_exception(Win32Exception("FindClose() failed", GetLastError()));
+               BOOST_THROW_EXCEPTION(Win32Exception("FindClose() failed", GetLastError()));
 
        return true;
 #else /* _WIN32 */
@@ -480,7 +480,7 @@ bool Utility::Glob(const String& pathSpec, const function<void (const String&)>&
                if (rc == GLOB_NOMATCH)
                        return false;
 
-               throw_exception(PosixException("glob() failed", errno));
+               BOOST_THROW_EXCEPTION(PosixException("glob() failed", errno));
        }
 
        if (gr.gl_pathc == 0) {
@@ -515,7 +515,7 @@ void Utility::WaitUntil(const function<bool (void)>& predicate)
                 * (like spawning a process) until the application instance
                 * has been initialized. */
                if (!instance)
-                       throw_exception(runtime_error("Waiting for predicate failed: Application instance is not initialized."));
+                       BOOST_THROW_EXCEPTION(runtime_error("Waiting for predicate failed: Application instance is not initialized."));
 
                instance->ProcessEvents();
        }
index a83a757396ccfc6f29a872f0b4ccddf2038094c8..53578fe82a4df0bcbab450eaec6a9b23c05e4b44 100644 (file)
@@ -74,7 +74,7 @@ Value Value::FromJson(cJSON *json)
        else if (json->type == cJSON_NULL)
                return Value();
        else
-               throw_exception(invalid_argument("Unsupported JSON type."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Unsupported JSON type."));
 }
 
 /**
@@ -126,7 +126,7 @@ cJSON *Value::ToJson(void) const
        } else if (m_Value.type() == typeid(boost::blank)) {
                return cJSON_CreateNull();
        } else {
-               throw_exception(runtime_error("Invalid variant type."));
+               BOOST_THROW_EXCEPTION(runtime_error("Invalid variant type."));
        }
 }
 
@@ -141,7 +141,7 @@ Value Value::Deserialize(const String& jsonString)
        cJSON *json = cJSON_Parse(jsonString.CStr());
 
        if (!json)
-               throw_exception(runtime_error("Invalid JSON String"));
+               BOOST_THROW_EXCEPTION(runtime_error("Invalid JSON String"));
 
        Value value = FromJson(json);
        cJSON_Delete(json);
index 5c52e79cc44631598299cf02a4782d3b661a22cf..b6623d871333178288383a006e353a01e54d7cd1 100644 (file)
@@ -67,7 +67,7 @@ public:
                Object::Ptr object = dynamic_pointer_cast<Object>(value);
 
                if (!object)
-                       throw_exception(invalid_argument("shared_ptr value type must inherit from Object class."));
+                       BOOST_THROW_EXCEPTION(invalid_argument("shared_ptr value type must inherit from Object class."));
 
                m_Value = object;
        }
@@ -103,7 +103,7 @@ public:
                shared_ptr<T> object = dynamic_pointer_cast<T>(boost::get<Object::Ptr>(m_Value));
 
                if (!object)
-                       throw_exception(bad_cast());
+                       BOOST_THROW_EXCEPTION(bad_cast());
 
                return object;
        }
index 308597e95a3af9e13560343ba74c979d362d0668..5a915bae8572f91e05ea2694877a2ed65eda9a7a 100644 (file)
@@ -237,7 +237,7 @@ void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err)
 {
        stringstream message;
        message << *locp << ": " << err;
-       throw_exception(runtime_error(message.str()));
+       ConfigCompilerContext::GetContext()->AddError(false, message.str());
 }
 
 int yyparse(ConfigCompiler *context);
@@ -257,7 +257,7 @@ void ConfigCompiler::Compile(void)
        try {
                yyparse(this);
        } catch (const exception& ex) {
-               ConfigCompilerContext::GetContext()->AddError(false, ex.what());
+               ConfigCompilerContext::GetContext()->AddError(false, boost::diagnostic_information(ex));
        }
 }
 
@@ -1671,7 +1671,7 @@ yyreduce:
                
                if (!m_Type) {
                        if ((yyvsp[(1) - (3)].num))
-                               throw_exception(invalid_argument("partial type definition for unknown type '" + name + "'"));
+                               BOOST_THROW_EXCEPTION(invalid_argument("Partial type definition for unknown type '" + name + "'"));
 
                        m_Type = boost::make_shared<ConfigType>(name, yylloc);
                        ConfigCompilerContext::GetContext()->AddType(m_Type);
index 8bb83388f21f3752832337ba99876ce0def765f3..e2de359586428bd507001d672ecca3d5969ca452 100644 (file)
@@ -87,7 +87,7 @@ void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err)
 {
        stringstream message;
        message << *locp << ": " << err;
-       throw_exception(runtime_error(message.str()));
+       ConfigCompilerContext::GetContext()->AddError(false, message.str());
 }
 
 int yyparse(ConfigCompiler *context);
@@ -107,7 +107,7 @@ void ConfigCompiler::Compile(void)
        try {
                yyparse(this);
        } catch (const exception& ex) {
-               ConfigCompilerContext::GetContext()->AddError(false, ex.what());
+               ConfigCompilerContext::GetContext()->AddError(false, boost::diagnostic_information(ex));
        }
 }
 
@@ -151,7 +151,7 @@ type: partial_specifier T_TYPE identifier
                
                if (!m_Type) {
                        if ($1)
-                               throw_exception(invalid_argument("partial type definition for unknown type '" + name + "'"));
+                               BOOST_THROW_EXCEPTION(invalid_argument("Partial type definition for unknown type '" + name + "'"));
 
                        m_Type = boost::make_shared<ConfigType>(name, yylloc);
                        ConfigCompilerContext::GetContext()->AddType(m_Type);
index a7f178c56309c3d0f233530e2468a337f288cc09..a499bb7f74fe60ae41d23941c633998deacfe31c 100644 (file)
@@ -138,7 +138,7 @@ void ConfigCompiler::CompileFile(const String& path)
        stream.open(path.CStr(), ifstream::in);
 
        if (!stream)
-               throw_exception(invalid_argument("Could not open config file: " + path));
+               BOOST_THROW_EXCEPTION(invalid_argument("Could not open config file: " + path));
 
        Logger::Write(LogInformation, "config", "Compiling config file: " + path);
 
@@ -195,7 +195,7 @@ void ConfigCompiler::HandleFileInclude(const String& include, bool search,
        if (!Utility::Glob(includePath, boost::bind(&ConfigCompiler::CompileFile, _1))) {
                stringstream msgbuf;
                msgbuf << "Include file '" + include + "' does not exist (or no files found for pattern): " << debuginfo;
-               throw_exception(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
        }
 }
 
index f37261b2ddf21294314e0fc3812350bf8aa7643a..302dbe13b22ccb06b7673df374da95df282a058e 100644 (file)
@@ -125,7 +125,7 @@ void ConfigItem::InternalLink(const Dictionary::Ptr& dictionary) const
                        stringstream message;
                        message << "Parent object '" << name << "' does not"
                            " exist (" << m_DebugInfo << ")";
-                       throw_exception(domain_error(message.str()));
+                       BOOST_THROW_EXCEPTION(domain_error(message.str()));
                }
 
                parent->InternalLink(dictionary);
@@ -169,7 +169,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
        DynamicType::Ptr dtype = DynamicType::GetByName(GetType());
 
        if (!dtype)
-               throw_exception(runtime_error("Type '" + GetType() + "' does not exist."));
+               BOOST_THROW_EXCEPTION(runtime_error("Type '" + GetType() + "' does not exist."));
 
        if (!dobj)
                dobj = dtype->GetObject(GetName());
index 3111a23bffe22a9cf584ed2711be231d050992c4..dde8c8d94635541eef6777031700e0df06e93e98 100644 (file)
@@ -90,19 +90,19 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
        if (m_Type.IsEmpty()) {
                stringstream msgbuf;
                msgbuf << "The type name of an object may not be empty: " << m_DebugInfo;
-               throw_exception(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
        }
 
        if (!DynamicType::GetByName(m_Type)) {
                stringstream msgbuf;
                msgbuf << "The type '" + m_Type + "' is unknown: " << m_DebugInfo;
-               throw_exception(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
        }
 
        if (m_Name.IsEmpty()) {
                stringstream msgbuf;
                msgbuf << "The name of an object may not be empty: " << m_DebugInfo;
-               throw_exception(invalid_argument(msgbuf.str()));
+               BOOST_THROW_EXCEPTION(invalid_argument(msgbuf.str()));
        }
 
        ExpressionList::Ptr exprl = boost::make_shared<ExpressionList>();
index f510630c279df7abb9f3269e1c1e88d287403bdc..52e57d6a6b90541fd80ba6c0347f1ecb3be93ef4 100644 (file)
@@ -117,7 +117,7 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
                        ScriptFunction::Ptr func = ScriptFunction::GetByName(validator);
 
                        if (!func)
-                               throw_exception(invalid_argument("Validator function '" + validator + "' does not exist."));
+                               BOOST_THROW_EXCEPTION(invalid_argument("Validator function '" + validator + "' does not exist."));
 
                        vector<Value> arguments;
                        arguments.push_back(LocationToString(locations));
index 71a9c8894f22ea42d7a654aa87e05f6392036757..3f777fe0d593b15dad5b64ec61eb53049dd49195 100644 (file)
@@ -46,7 +46,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
        switch (m_Operator) {
                case OperatorExecute:
                        if (!valueExprl)
-                               throw_exception(invalid_argument("Operand for OperatorExecute must be an ExpressionList."));
+                               BOOST_THROW_EXCEPTION(invalid_argument("Operand for OperatorExecute must be an ExpressionList."));
 
                        valueExprl->Execute(dictionary);
 
@@ -74,7 +74,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
                                            " += (non-dictionary and"
                                            " dictionary) ("
                                                << m_DebugInfo << ")";
-                                       throw_exception(domain_error(message.str()));
+                                       BOOST_THROW_EXCEPTION(domain_error(message.str()));
                                }
 
                                dict = boost::make_shared<Dictionary>();
@@ -94,13 +94,13 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
                                stringstream message;
                                message << "+= only works for dictionaries ("
                                        << m_DebugInfo << ")";
-                               throw_exception(domain_error(message.str()));
+                               BOOST_THROW_EXCEPTION(domain_error(message.str()));
                        }
 
                        break;
 
                default:
-                       throw_exception(runtime_error("Not yet implemented."));
+                       BOOST_THROW_EXCEPTION(runtime_error("Not yet implemented."));
        }
 
        dictionary->Set(m_Key, newValue);
@@ -154,7 +154,7 @@ void Expression::DumpValue(ostream& fp, int indent, const Value& value, bool inl
                return;
        }
 
-       throw_exception(runtime_error("Encountered unknown type while dumping value."));
+       BOOST_THROW_EXCEPTION(runtime_error("Encountered unknown type while dumping value."));
 }
 
 void Expression::Dump(ostream& fp, int indent) const
@@ -177,7 +177,7 @@ void Expression::Dump(ostream& fp, int indent) const
                        fp << "+=";
                        break;
                default:
-                       throw_exception(runtime_error("Not yet implemented."));
+                       BOOST_THROW_EXCEPTION(runtime_error("Not yet implemented."));
        }
 
        fp << " ";
index 110b147d8f5e0d556d4d40cbbdfa846373063de2..59efb8aa5602430c5cc74291839157fb93ec96c1 100644 (file)
@@ -30,12 +30,12 @@ void ExternalCommandProcessor::Execute(const String& line)
                return;
 
        if (line[0] != '[')
-               throw_exception(invalid_argument("Missing timestamp in command: " + line));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing timestamp in command: " + line));
 
        size_t pos = line.FindFirstOf("]");
 
        if (pos == String::NPos)
-               throw_exception(invalid_argument("Missing timestamp in command: " + line));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing timestamp in command: " + line));
 
        String timestamp = line.SubStr(1, pos - 1);
        String args = line.SubStr(pos + 2, String::NPos);
@@ -43,12 +43,12 @@ void ExternalCommandProcessor::Execute(const String& line)
        double ts = Convert::ToDouble(timestamp);
 
        if (ts == 0)
-               throw_exception(invalid_argument("Invalid timestamp in command: " + line));
+               BOOST_THROW_EXCEPTION(invalid_argument("Invalid timestamp in command: " + line));
 
        vector<String> argv = args.Split(is_any_of(";"));
 
        if (argv.size() == 0)
-               throw_exception(invalid_argument("Missing arguments in command: " + line));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing arguments in command: " + line));
 
        vector<String> argvExtra(argv.begin() + 1, argv.end());
        Execute(ts, argv[0], argvExtra);
@@ -107,7 +107,7 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const
        it = m_Commands.find(command);
 
        if (it == m_Commands.end())
-               throw_exception(invalid_argument("The external command '" + command + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The external command '" + command + "' does not exist."));
 
        it->second(time, arguments);
 }
@@ -120,15 +120,15 @@ void ExternalCommandProcessor::RegisterCommand(const String& command, const Exte
 void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vector<String>& arguments)
 {
        if (arguments.size() < 4)
-               throw_exception(invalid_argument("Expected 4 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 4 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
        if (!service->GetEnablePassiveChecks())
-               throw_exception(invalid_argument("Got passive check result for service '" + arguments[1] + "' which has passive checks disabled."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Got passive check result for service '" + arguments[1] + "' which has passive checks disabled."));
 
        int exitStatus = Convert::ToDouble(arguments[2]);
        Dictionary::Ptr result = PluginCheckTask::ParseCheckOutput(arguments[3]);
@@ -152,10 +152,10 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vect
 void ExternalCommandProcessor::ScheduleSvcCheck(double, const vector<String>& arguments)
 {
        if (arguments.size() < 3)
-               throw_exception(invalid_argument("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 3 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -174,10 +174,10 @@ void ExternalCommandProcessor::ScheduleSvcCheck(double, const vector<String>& ar
 void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const vector<String>& arguments)
 {
        if (arguments.size() < 3)
-               throw_exception(invalid_argument("Expected 3 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 3 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -189,10 +189,10 @@ void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const vector<Strin
 void ExternalCommandProcessor::EnableSvcCheck(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -203,10 +203,10 @@ void ExternalCommandProcessor::EnableSvcCheck(double, const vector<String>& argu
 void ExternalCommandProcessor::DisableSvcCheck(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -223,10 +223,10 @@ void ExternalCommandProcessor::ShutdownProcess(double, const vector<String>&)
 void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        double planned_check = Convert::ToDouble(arguments[1]);
 
@@ -242,10 +242,10 @@ void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const vector<
 void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        double planned_check = Convert::ToDouble(arguments[1]);
 
@@ -266,10 +266,10 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const vector<String
 void ExternalCommandProcessor::EnableHostSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -282,10 +282,10 @@ void ExternalCommandProcessor::EnableHostSvcChecks(double, const vector<String>&
 void ExternalCommandProcessor::DisableHostSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -298,17 +298,17 @@ void ExternalCommandProcessor::DisableHostSvcChecks(double, const vector<String>
 void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const vector<String>& arguments)
 {
        if (arguments.size() < 7)
-               throw_exception(invalid_argument("Expected 7 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 7 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        bool sticky = Convert::ToBool(arguments[2]);
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
        if (service->GetState() == StateOK)
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' is OK."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' is OK."));
 
        Logger::Write(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
        service->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
@@ -318,10 +318,10 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const vector<String
 void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        bool sticky = Convert::ToBool(arguments[2]);
        double timestamp = Convert::ToDouble(arguments[5]);
@@ -329,7 +329,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<
        Service::Ptr service = Service::GetByName(arguments[1]);
 
        if (service->GetState() == StateOK)
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' is OK."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' is OK."));
 
        Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
        service->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
@@ -339,10 +339,10 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<
 void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -354,17 +354,17 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector<Str
 void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector<String>& arguments)
 {
        if (arguments.size() < 6)
-               throw_exception(invalid_argument("Expected 6 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 6 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        bool sticky = Convert::ToBool(arguments[0]);
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        if (host->IsUp())
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' is OK."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
 
        Logger::Write(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
        host->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
@@ -374,10 +374,10 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector<Strin
 void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector<String>& arguments)
 {
        if (arguments.size() < 7)
-               throw_exception(invalid_argument("Expected 7 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 7 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        bool sticky = Convert::ToBool(arguments[1]);
        double timestamp = Convert::ToDouble(arguments[4]);
@@ -385,7 +385,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector
        Host::Ptr host = Host::GetByName(arguments[0]);
 
        if (host->IsUp())
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' is OK."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
 
        Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
        host->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
@@ -395,10 +395,10 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector
 void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -410,10 +410,10 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const vector<St
 void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!HostGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -428,10 +428,10 @@ void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector<Str
 void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!HostGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -446,10 +446,10 @@ void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const vector<St
 void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!ServiceGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -462,10 +462,10 @@ void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const vector<
 void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!ServiceGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -478,10 +478,10 @@ void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const vector
 void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -492,10 +492,10 @@ void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const vector<Strin
 void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -506,10 +506,10 @@ void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const vector<Stri
 void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!ServiceGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -522,10 +522,10 @@ void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const
 void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!ServiceGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service group '" + arguments[0] + "' does not exist."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -538,10 +538,10 @@ void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const
 void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!HostGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -556,10 +556,10 @@ void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const vec
 void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!HostGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -574,7 +574,7 @@ void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const ve
 void ExternalCommandProcessor::ProcessFile(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        String file = arguments[0];
        bool del = Convert::ToBool(arguments[1]);
@@ -594,7 +594,7 @@ void ExternalCommandProcessor::ProcessFile(double, const vector<String>& argumen
                        Execute(line);
                } catch (const exception& ex) {
                        stringstream msgbuf;
-                       msgbuf << "External command failed: " << ex.what();
+                       msgbuf << "External command failed: " << diagnostic_information(ex);
                        Logger::Write(LogWarning, "icinga", msgbuf.str());
                }
        }
@@ -608,10 +608,10 @@ void ExternalCommandProcessor::ProcessFile(double, const vector<String>& argumen
 void ExternalCommandProcessor::ScheduleSvcDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 9)
-               throw_exception(invalid_argument("Expected 9 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 9 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -629,7 +629,7 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double, const vector<String>&
 void ExternalCommandProcessor::DelSvcDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
        Logger::Write(LogInformation, "icinga", "Removing downtime ID " + arguments[0]);
@@ -640,10 +640,10 @@ void ExternalCommandProcessor::DelSvcDowntime(double, const vector<String>& argu
 void ExternalCommandProcessor::ScheduleHostDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -661,7 +661,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const vector<String>
 void ExternalCommandProcessor::DelHostDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
        Logger::Write(LogInformation, "icinga", "Removing downtime ID " + arguments[0]);
@@ -672,10 +672,10 @@ void ExternalCommandProcessor::DelHostDowntime(double, const vector<String>& arg
 void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 argument."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -700,10 +700,10 @@ void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const vector<Stri
 void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
 
        if (!HostGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -723,10 +723,10 @@ void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const vecto
 void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
 
        if (!HostGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
 
@@ -758,10 +758,10 @@ void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const vector
 void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
 
        if (!ServiceGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -791,10 +791,10 @@ void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const ve
 void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const vector<String>& arguments)
 {
        if (arguments.size() < 8)
-               throw_exception(invalid_argument("Expected 8 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 8 arguments."));
 
        if (!ServiceGroup::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host group '" + arguments[0] + "' does not exist."));
 
        ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
 
@@ -814,10 +814,10 @@ void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const vec
 void ExternalCommandProcessor::AddHostComment(double, const vector<String>& arguments)
 {
        if (arguments.size() < 4)
-               throw_exception(invalid_argument("Expected 4 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 4 arguments."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -828,7 +828,7 @@ void ExternalCommandProcessor::AddHostComment(double, const vector<String>& argu
 void ExternalCommandProcessor::DelHostComment(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
        Logger::Write(LogInformation, "icinga", "Removing comment ID " + arguments[0]);
@@ -839,10 +839,10 @@ void ExternalCommandProcessor::DelHostComment(double, const vector<String>& argu
 void ExternalCommandProcessor::AddSvcComment(double, const vector<String>& arguments)
 {
        if (arguments.size() < 5)
-               throw_exception(invalid_argument("Expected 5 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 5 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
@@ -853,7 +853,7 @@ void ExternalCommandProcessor::AddSvcComment(double, const vector<String>& argum
 void ExternalCommandProcessor::DelSvcComment(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        int id = Convert::ToLong(arguments[0]);
        Logger::Write(LogInformation, "icinga", "Removing comment ID " + arguments[0]);
@@ -865,10 +865,10 @@ void ExternalCommandProcessor::DelSvcComment(double, const vector<String>& argum
 void ExternalCommandProcessor::DelAllHostComments(double, const vector<String>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Expected 1 argument."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 1 argument."));
 
        if (!Host::Exists(arguments[0]))
-               throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' does not exist."));
 
        Host::Ptr host = Host::GetByName(arguments[0]);
 
@@ -879,10 +879,10 @@ void ExternalCommandProcessor::DelAllHostComments(double, const vector<String>&
 void ExternalCommandProcessor::DelAllSvcComments(double, const vector<String>& arguments)
 {
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Expected 2 arguments."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Expected 2 arguments."));
 
        if (!Service::Exists(arguments[1]))
-               throw_exception(invalid_argument("The service '" + arguments[1] + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("The service '" + arguments[1] + "' does not exist."));
 
        Service::Ptr service = Service::GetByName(arguments[1]);
 
index c0604d399b4fbe0eeccb09faee7ab46e1ca5f80b..e3ac527995535b9c70872d6f1400a134a885f2cb 100644 (file)
@@ -76,7 +76,7 @@ Host::Ptr Host::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("Host", name);
 
        if (!configObject)
-               throw_exception(invalid_argument("Host '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Host '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<Host>(configObject);
 }
@@ -270,7 +270,7 @@ void Host::ObjectCommittedHandler(const ConfigItem::Ptr& item)
 
                                CopyServiceAttributes(host, service, builder);
                        } else {
-                               throw_exception(invalid_argument("Service description must be either a string or a dictionary."));
+                               BOOST_THROW_EXCEPTION(invalid_argument("Service description must be either a string or a dictionary."));
                        }
 
                        ConfigItem::Ptr serviceItem = builder->Compile();
@@ -410,10 +410,10 @@ void Host::ValidateServicesCache(void)
 void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Missing argument: Location must be specified."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Location must be specified."));
 
        if (arguments.size() < 2)
-               throw_exception(invalid_argument("Missing argument: Attribute dictionary must be specified."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Attribute dictionary must be specified."));
 
        String location = arguments[0];
        Dictionary::Ptr attrs = arguments[1];
index c79bb042942eb05d36eb552451ebedb873a47d95..137768c725e7778e603cf5e0cd8d9a46c47f99e4 100644 (file)
@@ -56,7 +56,7 @@ HostGroup::Ptr HostGroup::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("HostGroup", name);
 
        if (!configObject)
-               throw_exception(invalid_argument("HostGroup '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("HostGroup '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<HostGroup>(configObject);
 }
index 93365aaa960096830c3691660ded26e29378d619..4561aab9768ef0e31eb3c9363432c8f5af652e33 100644 (file)
@@ -32,7 +32,7 @@ String MacroProcessor::ResolveMacros(const String& str, const vector<Dictionary:
                pos_second = result.FindFirstOf("$", pos_first + 1);
 
                if (pos_second == String::NPos)
-                       throw_exception(runtime_error("Closing $ not found in macro format String."));
+                       BOOST_THROW_EXCEPTION(runtime_error("Closing $ not found in macro format String."));
 
                String name = result.SubStr(pos_first + 1, pos_second - pos_first - 1);
                String value;
@@ -51,7 +51,7 @@ String MacroProcessor::ResolveMacros(const String& str, const vector<Dictionary:
                }
 
                if (!resolved)
-                       throw_exception(runtime_error("Macro '" + name + "' is not defined."));
+                       BOOST_THROW_EXCEPTION(runtime_error("Macro '" + name + "' is not defined."));
        }
 
        return result;
index 5c4734366d4658c8e85493f02725faef79e9169a..92c39f03f63a7ece74b486f37863c758697a6942 100644 (file)
@@ -26,7 +26,7 @@ REGISTER_SCRIPTFUNCTION("native::NullCheck",  &NullCheckTask::ScriptFunc);
 void NullCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Missing argument: Service must be specified."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Service must be specified."));
 
        Dictionary::Ptr cr = boost::make_shared<Dictionary>();
        cr->Set("state", StateUnknown);
index 39b643e172c067e965b1cdc1c295edf3500b48fb..28a362ee42a60675bc4470d17eba584b12ba4320 100644 (file)
@@ -30,11 +30,11 @@ PluginCheckTask::PluginCheckTask(const ScriptTask::Ptr& task, const Process::Ptr
 void PluginCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments)
 {
        if (arguments.size() < 1)
-               throw_exception(invalid_argument("Missing argument: Service must be specified."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Service must be specified."));
 
        Value vservice = arguments[0];
        if (!vservice.IsObjectType<DynamicObject>())
-               throw_exception(invalid_argument("Argument must be a config object."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Argument must be a config object."));
 
        Service::Ptr service = static_cast<Service::Ptr>(vservice);
 
index 1f4c3278dd6123698e861afc8f3c24cd4bb2f6e8..dbd58677132328fdba747a2589d8a3c9efbe844d 100644 (file)
@@ -87,7 +87,7 @@ Service::Ptr Service::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("Service", name);
 
        if (!configObject)
-               throw_exception(invalid_argument("Service '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Service '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<Service>(configObject);
 }
@@ -97,7 +97,7 @@ Host::Ptr Service::GetHost(void) const
        String hostname = Get("host_name");
 
        if (hostname.IsEmpty())
-               throw_exception(runtime_error("Service object is missing the 'host_name' property."));
+               BOOST_THROW_EXCEPTION(runtime_error("Service object is missing the 'host_name' property."));
 
        return Host::GetByName(hostname);
 }
@@ -290,7 +290,7 @@ double Service::GetNextCheck(void)
                value = Get("next_check");
 
                if (value.IsEmpty())
-                       throw_exception(runtime_error("Failed to schedule next check."));
+                       BOOST_THROW_EXCEPTION(runtime_error("Failed to schedule next check."));
        }
 
        return value;
@@ -707,7 +707,7 @@ void Service::CheckCompletedHandler(const Dictionary::Ptr& scheduleInfo,
        } catch (const exception& ex) {
                stringstream msgbuf;
                msgbuf << "Exception occured during check for service '"
-                      << GetName() << "': " << ex.what();
+                      << GetName() << "': " << diagnostic_information(ex);
                String message = msgbuf.str();
 
                Logger::Write(LogWarning, "checker", message);
index b59d882a4e5422ed435d442a3aaa00f318e6e3bb..7479a68cde5f7cdb26a52377a60d6bc2c99af98b 100644 (file)
@@ -56,7 +56,7 @@ ServiceGroup::Ptr ServiceGroup::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("ServiceGroup", name);
 
        if (!configObject)
-               throw_exception(invalid_argument("ServiceGroup '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("ServiceGroup '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<ServiceGroup>(configObject);
 }
index b46caef37ee98870f36b9a18d28900546d92ff9f..c68c67ce33d55d971d4b393866f43ed2a4a7f627 100644 (file)
@@ -48,7 +48,7 @@ TimePeriod::Ptr TimePeriod::GetByName(const String& name)
        DynamicObject::Ptr configObject = DynamicObject::GetObject("TimePeriod", name);
 
        if (!configObject)
-               throw_exception(invalid_argument("TimePeriod '" + name + "' does not exist."));
+               BOOST_THROW_EXCEPTION(invalid_argument("TimePeriod '" + name + "' does not exist."));
 
        return dynamic_pointer_cast<TimePeriod>(configObject);
 }
index c927fdb1183246320d2c3b33b423d99f229187e4..32659adb7995b86d8ca8a31afb8a24a2acdb330a 100644 (file)
@@ -66,7 +66,7 @@ Endpoint::Ptr Endpoint::GetByName(const String& name)
         DynamicObject::Ptr configObject = DynamicObject::GetObject("Endpoint", name);
 
         if (!configObject)
-                throw_exception(invalid_argument("Endpoint '" + name + "' does not exist."));
+                BOOST_THROW_EXCEPTION(invalid_argument("Endpoint '" + name + "' does not exist."));
 
         return dynamic_pointer_cast<Endpoint>(configObject);
 }
@@ -224,7 +224,7 @@ void Endpoint::UnregisterTopicHandler(const String& topic, const function<Endpoi
        //m_TopicHandlers[method] -= callback;
        //UnregisterSubscription(method);
 
-       throw_exception(NotImplementedException());
+       BOOST_THROW_EXCEPTION(NotImplementedException());
 }
 
 void Endpoint::OnAttributeChanged(const String& name, const Value& oldValue)
@@ -324,7 +324,7 @@ void Endpoint::ClientClosedHandler(void)
                GetClient()->CheckException();
        } catch (const exception& ex) {
                stringstream message;
-               message << "Error occured for JSON-RPC socket: Message=" << ex.what();
+               message << "Error occured for JSON-RPC socket: Message=" << diagnostic_information(ex);
 
                Logger::Write(LogWarning, "jsonrpc", message.str());
        }*/
index 883b260ff631153b45d7daf30601d6b1f7db2207..ebb90c795914528d690c5fc62330d849e89ccda8 100644 (file)
@@ -104,7 +104,7 @@ void EndpointManager::AddListener(const String& service)
        shared_ptr<SSL_CTX> sslContext = GetSSLContext();
 
        if (!sslContext)
-               throw_exception(logic_error("SSL context is required for AddListener()"));
+               BOOST_THROW_EXCEPTION(logic_error("SSL context is required for AddListener()"));
 
        stringstream s;
        s << "Adding new listener: port " << service;
@@ -131,7 +131,7 @@ void EndpointManager::AddConnection(const String& node, const String& service) {
        shared_ptr<SSL_CTX> sslContext = GetSSLContext();
 
        if (!sslContext)
-               throw_exception(logic_error("SSL context is required for AddConnection()"));
+               BOOST_THROW_EXCEPTION(logic_error("SSL context is required for AddConnection()"));
 
        TcpSocket::Ptr client = boost::make_shared<TcpSocket>();
        client->Connect(node, service);
@@ -229,7 +229,7 @@ void EndpointManager::SendAnycastMessage(const Endpoint::Ptr& sender,
 {
        String method;
        if (!message.GetMethod(&method))
-               throw_exception(invalid_argument("Message is missing the 'method' property."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Message is missing the 'method' property."));
 
        vector<Endpoint::Ptr> candidates;
        DynamicObject::Ptr object;
@@ -273,11 +273,11 @@ void EndpointManager::SendMulticastMessage(const Endpoint::Ptr& sender,
 {
        String id;
        if (message.GetID(&id))
-               throw_exception(invalid_argument("Multicast requests must not have an ID."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Multicast requests must not have an ID."));
 
        String method;
        if (!message.GetMethod(&method))
-               throw_exception(invalid_argument("Message is missing the 'method' property."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Message is missing the 'method' property."));
 
        DynamicObject::Ptr object;
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicType::GetByName("Endpoint")->GetObjects()) {
@@ -391,7 +391,7 @@ void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender,
 {
        String id;
        if (!message.GetID(&id))
-               throw_exception(invalid_argument("Response message must have a message ID."));
+               BOOST_THROW_EXCEPTION(invalid_argument("Response message must have a message ID."));
 
        map<String, PendingRequest>::iterator it;
        it = m_Requests.find(id);
index 22ec9744f0fe4e521809c41fd02147b77d951ce4..15fc68461a6442bec0bc80a35e8858a45e44d683 100644 (file)
@@ -57,7 +57,7 @@ void JsonRpcConnection::ProcessData(void)
                        Value value = Value::Deserialize(jsonString);
 
                        if (!value.IsObjectType<Dictionary>()) {
-                               throw_exception(invalid_argument("JSON-RPC"
+                               BOOST_THROW_EXCEPTION(invalid_argument("JSON-RPC"
                                    " message must be a dictionary."));
                        }
 
@@ -65,7 +65,7 @@ void JsonRpcConnection::ProcessData(void)
                } catch (const exception& ex) {
                        Logger::Write(LogCritical, "remoting", "Exception"
                            " while processing message from JSON-RPC client: " +
-                           String(ex.what()));
+                           diagnostic_information(ex));
                }
        }
 }